From 4b8330c36d3177db67f58f8a59ff365905362e52 Mon Sep 17 00:00:00 2001 From: Joel Kenny Date: Fri, 11 Oct 2019 12:49:41 -0400 Subject: [PATCH] [stable/cockroachdb] Fix for compatibiliy with Kubernetes 1.16 (#17837) In Kubernetes 1.16, all resources under `apps/v1beta1` are now only available under `apps/v1`: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#deprecations-and-removals This updates our StatefulSet apiVersion, while maintaining compatibility with old versions of Kubernetes where StatefulSets are not available under the `apps/v1` APIVersion. Signed-off-by: Joel Kenny --- stable/cockroachdb/Chart.yaml | 2 +- stable/cockroachdb/templates/_helpers.tpl | 11 +++++++++++ stable/cockroachdb/templates/statefulset.yaml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stable/cockroachdb/Chart.yaml b/stable/cockroachdb/Chart.yaml index d0206b23be..5254f4b2f4 100755 --- a/stable/cockroachdb/Chart.yaml +++ b/stable/cockroachdb/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: cockroachdb home: https://www.cockroachlabs.com -version: 2.1.14 +version: 2.1.15 appVersion: 19.1.5 description: CockroachDB is a scalable, survivable, strongly-consistent SQL database. icon: https://raw.githubusercontent.com/cockroachdb/cockroach/master/docs/media/cockroach_db.png diff --git a/stable/cockroachdb/templates/_helpers.tpl b/stable/cockroachdb/templates/_helpers.tpl index 86e6c3afee..7f62ebea0e 100644 --- a/stable/cockroachdb/templates/_helpers.tpl +++ b/stable/cockroachdb/templates/_helpers.tpl @@ -19,3 +19,14 @@ Create the name of the service account to use {{ default "default" .Values.Secure.ServiceAccount.Name }} {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for StatefulSets +*/}} +{{- define "statefulset.apiVersion" -}} +{{- if semverCompare "<1.12-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} diff --git a/stable/cockroachdb/templates/statefulset.yaml b/stable/cockroachdb/templates/statefulset.yaml index 8b2755c309..1d8b04aaa9 100644 --- a/stable/cockroachdb/templates/statefulset.yaml +++ b/stable/cockroachdb/templates/statefulset.yaml @@ -1,4 +1,4 @@ -apiVersion: apps/v1beta1 +apiVersion: {{ template "statefulset.apiVersion" . }} kind: StatefulSet metadata: name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}"