Skip to content

Commit

Permalink
fix(stable/cockroachdb): Add an explicit selector to the StatefulSet (h…
Browse files Browse the repository at this point in the history
…elm#8109)

This was preventing any upgrades because kubernetes made the selector
immutable and the chart version changes between upgrades of charts.

fix helm#8102

Signed-off-by: Rio Kierkels <riokierkels@gmail.com>
Signed-off-by: Jakob Niggel <info@jakobniggel.de>
  • Loading branch information
rio authored and Jnig committed Nov 13, 2018
1 parent 8033585 commit 42c0c8e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/cockroachdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 18 additions & 0 deletions stable/cockroachdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions stable/cockroachdb/templates/cockroachdb-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 42c0c8e

Please sign in to comment.