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
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(-)
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
22 +Return the appropriate apiVersion for statefulset.
24 +{{- define "elasticsearch.statefulset.apiVersion" -}}
25 +{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}}
26 +{{- print "apps/v1beta2" -}}
28 +{{- print "apps/v1" -}}
33 +Return the appropriate apiVersion for ingress.
35 +{{- define "elasticsearch.ingress.apiVersion" -}}
36 +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
37 +{{- print "extensions/v1beta1" -}}
39 +{{- print "networking.k8s.io/v1beta1" -}}
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
47 {{- $fullName := include "uname" . -}}
48 {{- $servicePort := .Values.httpPort -}}
49 {{- $ingressPath := .Values.ingress.path -}}
50 -apiVersion: extensions/v1beta1
51 +apiVersion: {{ template "elasticsearch.ingress.apiVersion" . }}
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
61 -apiVersion: apps/v1beta1
62 +apiVersion: {{ template "elasticsearch.statefulset.apiVersion" . }}
65 name: {{ template "uname" . }}