From 85cddea40ff1f0edbc405dd6f5b150cbaea927a8 Mon Sep 17 00:00:00 2001 From: Rio Kierkels Date: Thu, 4 Oct 2018 22:41:55 +0200 Subject: [PATCH] fix(stable/cockroachdb): Add an explicit selector to the StatefulSet (#8109) This was preventing any upgrades because kubernetes made the selector immutable and the chart version changes between upgrades of charts. fix #8102 Signed-off-by: Rio Kierkels --- stable/cockroachdb/Chart.yaml | 2 +- stable/cockroachdb/README.md | 18 ++++++++++++++++++ .../templates/cockroachdb-statefulset.yaml | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/stable/cockroachdb/Chart.yaml b/stable/cockroachdb/Chart.yaml index 539889290c..7c88911ac7 100755 --- a/stable/cockroachdb/Chart.yaml +++ b/stable/cockroachdb/Chart.yaml @@ -1,6 +1,6 @@ name: cockroachdb home: https://www.cockroachlabs.com -version: 1.2.6 +version: 2.0.0 appVersion: 2.0.6 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/README.md b/stable/cockroachdb/README.md index 5dddcdcafd..c117a13d73 100644 --- a/stable/cockroachdb/README.md +++ b/stable/cockroachdb/README.md @@ -37,6 +37,24 @@ certificate for each node (e.g. `default.node.eerie-horse-cockroachdb-0` and one client certificate for the job that initializes the cluster (e.g. `default.node.root`). +## Upgrading +### To 2.0.0 +Due to having no explicit selector set for the StatefulSet before version 2.0.0 of +this chart, upgrading from any version that uses a version of kubernetes that locks +the selector labels to any other version is impossible without deleting the StatefulSet. +Luckily there is a way to do it without actually deleting all the resources managed +by the StatefulSet. Use the workaround below to upgrade from versions previous to 2.0.0. +The following example assumes that the release name is crdb: + +```console +$ kubectl delete statefulset crdb-cockroachdb --cascade=false +``` + +Verify that no pod is deleted and then upgrade as normal. A new StatefulSet will +be created taking over the management of the existing pods upgrading them if needed. + +For more information about the upgrading bug see https://github.com/helm/charts/issues/7680. + ## Configuration The following table lists the configurable parameters of the CockroachDB chart and their default values. diff --git a/stable/cockroachdb/templates/cockroachdb-statefulset.yaml b/stable/cockroachdb/templates/cockroachdb-statefulset.yaml index 03df4bcde8..b7102db895 100644 --- a/stable/cockroachdb/templates/cockroachdb-statefulset.yaml +++ b/stable/cockroachdb/templates/cockroachdb-statefulset.yaml @@ -185,6 +185,11 @@ metadata: spec: serviceName: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" replicas: {{ default 3 .Values.Replicas }} + selector: + matchLabels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + component: "{{ .Release.Name }}-{{ .Values.Component }}" template: metadata: labels: