From 54d6f9c128584b8b1591848dd3645ee67770cb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= Date: Mon, 24 Sep 2018 11:44:45 +0200 Subject: [PATCH] [stable/redis] Major version bump: Fix chart not being upgradable by removing 'chart' label from spec.selector or spec.VolumeClaimTemplate. (#7686) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also set a selector to all Deployments. See https://github.com/helm/charts/issues/7680. Signed-off-by: Cédric de Saint Martin --- stable/redis/Chart.yaml | 2 +- stable/redis/README.md | 25 +++++++++++++++++++ .../redis/templates/metrics-deployment.yaml | 5 ++++ .../templates/redis-master-statefulset.yaml | 2 -- .../templates/redis-slave-deployment.yaml | 5 ++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/stable/redis/Chart.yaml b/stable/redis/Chart.yaml index 8a4785d2d75a..7f7508987f8b 100644 --- a/stable/redis/Chart.yaml +++ b/stable/redis/Chart.yaml @@ -1,5 +1,5 @@ name: redis -version: 3.10.0 +version: 4.0.0 appVersion: 4.0.11 description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. keywords: diff --git a/stable/redis/README.md b/stable/redis/README.md index a537a156134a..5a4befad9aa8 100644 --- a/stable/redis/README.md +++ b/stable/redis/README.md @@ -45,6 +45,31 @@ $ helm delete my-release The command removes all the Kubernetes components associated with the chart and deletes the release. +## Upgrading an existing Release to a new major version + +A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an +incompatible breaking change needing manual actions. + +### 4.0.0 + +This version removes the `chart` label from the `spec.selector.matchLabels` +which is immutable since `StatefulSet apps/v1beta2`. It has been inadvertently +added, causing any subsequent upgrade to fail. See https://github.com/helm/charts/issues/7726. + +It also fixes https://github.com/helm/charts/issues/7726 where a deployment `extensions/v1beta1` can not be upgraded if `spec.selector` is not explicitely set. + +Finally, it fixes https://github.com/helm/charts/issues/7803 by removing mutable labels in `spec.VolumeClaimTemplate.metadata.labels` so that it is upgradable. + +In order to upgrade, delete the Redis StatefulSet before upgrading: +```bash +$ kubectl delete statefulsets.apps --cascade=false my-release-redis-master +``` +And edit the Redis slave (and metrics if enabled) deployment: +```bash +kubectl patch deployments my-release-redis-slave --type=json -p='[{"op": "remove", "path": "/spec/selector/matchLabels/chart"}]' +kubectl patch deployments my-release-redis-metrics --type=json -p='[{"op": "remove", "path": "/spec/selector/matchLabels/chart"}]' +``` + ## Configuration The following table lists the configurable parameters of the Redis chart and their default values. diff --git a/stable/redis/templates/metrics-deployment.yaml b/stable/redis/templates/metrics-deployment.yaml index 5f33b7d6ad72..f9d425168e28 100644 --- a/stable/redis/templates/metrics-deployment.yaml +++ b/stable/redis/templates/metrics-deployment.yaml @@ -9,6 +9,11 @@ metadata: release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" spec: + selector: + matchLabels: + release: "{{ .Release.Name }}" + role: metrics + app: {{ template "redis.name" . }} template: metadata: labels: diff --git a/stable/redis/templates/redis-master-statefulset.yaml b/stable/redis/templates/redis-master-statefulset.yaml index 428f2018914d..7a77518fb35b 100644 --- a/stable/redis/templates/redis-master-statefulset.yaml +++ b/stable/redis/templates/redis-master-statefulset.yaml @@ -11,7 +11,6 @@ spec: selector: matchLabels: release: "{{ .Release.Name }}" - chart: {{ template "redis.chart" . }} role: master app: {{ template "redis.name" . }} serviceName: "redis-master" @@ -161,7 +160,6 @@ spec: name: redis-data labels: app: "{{ template "redis.name" . }}" - chart: {{ template "redis.chart" . }} component: "master" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} diff --git a/stable/redis/templates/redis-slave-deployment.yaml b/stable/redis/templates/redis-slave-deployment.yaml index 8e3711a3a8bd..d587f55fc493 100644 --- a/stable/redis/templates/redis-slave-deployment.yaml +++ b/stable/redis/templates/redis-slave-deployment.yaml @@ -12,6 +12,11 @@ spec: {{- if .Values.cluster.slaveCount }} replicas: {{ .Values.cluster.slaveCount }} {{- end }} + selector: + matchLabels: + release: "{{ .Release.Name }}" + role: slave + app: {{ template "redis.name" . }} template: metadata: labels: