Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-flock / stx-monitor-armada-app / monitor-helm-elastic / 0002-Add-compatibility-for-k8s-1.16.patch
1 From f79169b8e6a57881952ca4d2c338eeda179471e9 Mon Sep 17 00:00:00 2001
2 From: Kevin Smith <kevin.smith@windriver.com>
3 Date: Mon, 7 Oct 2019 11:18:05 -0400
4 Subject: [PATCH 1/1] Add compatibility for k8s 1.16
5
6 ---
7  elasticsearch/templates/_helpers.tpl     | 22 ++++++++++++++++++++++
8  elasticsearch/templates/ingress.yaml     |  2 +-
9  elasticsearch/templates/statefulset.yaml |  2 +-
10  3 files changed, 24 insertions(+), 2 deletions(-)
11
12 diff --git a/elasticsearch/templates/_helpers.tpl b/elasticsearch/templates/_helpers.tpl
13 index d651d56..ccfd8c3 100755
14 --- a/elasticsearch/templates/_helpers.tpl
15 +++ b/elasticsearch/templates/_helpers.tpl
16 @@ -47,3 +47,25 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
17    {{- end -}}
18  {{- end -}}
19  {{- end -}}
20 +
21 +{{/*
22 +Return the appropriate apiVersion for statefulset.
23 +*/}}
24 +{{- define "elasticsearch.statefulset.apiVersion" -}}
25 +{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}}
26 +{{- print "apps/v1beta2" -}}
27 +{{- else -}}
28 +{{- print "apps/v1" -}}
29 +{{- end -}}
30 +{{- end -}}
31 +
32 +{{/*
33 +Return the appropriate apiVersion for ingress.
34 +*/}}
35 +{{- define "elasticsearch.ingress.apiVersion" -}}
36 +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
37 +{{- print "extensions/v1beta1" -}}
38 +{{- else -}}
39 +{{- print "networking.k8s.io/v1beta1" -}}
40 +{{- end -}}
41 +{{- end -}}
42 diff --git a/elasticsearch/templates/ingress.yaml b/elasticsearch/templates/ingress.yaml
43 index 39167ca..1715b97 100644
44 --- a/elasticsearch/templates/ingress.yaml
45 +++ b/elasticsearch/templates/ingress.yaml
46 @@ -2,7 +2,7 @@
47  {{- $fullName := include "uname" . -}}
48  {{- $servicePort := .Values.httpPort -}}
49  {{- $ingressPath := .Values.ingress.path -}}
50 -apiVersion: extensions/v1beta1
51 +apiVersion: {{ template "elasticsearch.ingress.apiVersion" . }}
52  kind: Ingress
53  metadata:
54    name: {{ $fullName }}
55 diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml
56 index 004578f..36c7af6 100644
57 --- a/elasticsearch/templates/statefulset.yaml
58 +++ b/elasticsearch/templates/statefulset.yaml
59 @@ -1,5 +1,5 @@
60  ---
61 -apiVersion: apps/v1beta1
62 +apiVersion: {{ template "elasticsearch.statefulset.apiVersion" . }}
63  kind: StatefulSet
64  metadata:
65    name: {{ template "uname" . }}
66 -- 
67 1.8.3.1
68