Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Putting chart version in spec.VolumeClaimTemplate.metadata.labels of a StatefulSet prevents ANY future upgrade of existing Release #7803

Closed
desaintmartin opened this issue Sep 18, 2018 · 7 comments · Fixed by #12402

Comments

@desaintmartin
Copy link
Collaborator

desaintmartin commented Sep 18, 2018

BUG REPORT

tl;dr: any Chart containing a StatefulSet (any version) using a chart version in a volumeClaimTemplate can't be upgraded

This is the third and hopefully the last bug regarding "I can't upgrade my Release".

Note:

Forewords

  • Kubernetes API defines that some fields are immutable. In particular:
    • For a StatefulSet, everything except spec.replicas, spec.template, and spec.updateStrategy (i.e spec.selectorand spec.VolumeClaimTemplate is immutable)

The problem

In some charts, we set the chart version (directly or through the chart template) in spec.VolumeClaimTemplate.metadata.labels.

This causes helm to attempt to change immutable fields and any upgrade (even if it ONLY change the version in Chart.yaml) will fail.

IN OTHER WORDS, SOME CHARTS OF THIS REPOSITORY ARE DEEPLY BROKEN AND CAN'T BE UPGRADED, only installed once.

Impacted charts

At least, impacted charts are:

How to reproduce (using stable/mariadb as an example)

Let's install the stable/mariadb chart using git, change the version in chart.yaml (example: 1.2.3 -> 1.2.4) without changing anything else, and try to upgrade. See it fail:

cd stable/mariadb
helm install --name test .
vim Chart.yaml
helm upgrade test .

Because of spec.volumeClaimTemplate.0.metadata.labels in templates/master-statefulset.yaml containing:

chart: {{ template "mariadb.chart" . }}

It will fail with:

Error: UPGRADE FAILED: StatefulSet.apps "redis-test-master" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden.

Let's remove this chart label, uninstall and try to reproduce: the bug is gone.

Conclusion

  • tl;dr: DO NOT put fields that may change in volumeClaimTemplate, especially chart label.
  • Any fix to this is a breaking change. But any other unrelated change to already impacted chart breaks existing Releases.
  • A potential workaround or "how to upgrade" is to remove the StatefulSet:
kubectl delete statefulsets.apps --cascade=false test-redis-master

and upgrade.

cc @mattfarina @scottrigby @juan131 @javsalgar @unguiculus @davidkarlsen @cpanato

@desaintmartin
Copy link
Collaborator Author

ping @kocolosk @alexeyklyukin @linki

k8s-ci-robot pushed a commit that referenced this issue Oct 23, 2018
…lumeClaimTemplate.metadata.labels being immutable (#8594)

See #7803

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Jnig pushed a commit to Jnig/charts that referenced this issue Nov 13, 2018
…lumeClaimTemplate.metadata.labels being immutable (helm#8594)

See helm#7803

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Signed-off-by: Jakob Niggel <info@jakobniggel.de>
@stale
Copy link

stale bot commented Nov 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 18, 2018
@desaintmartin
Copy link
Collaborator Author

#8527 for couchdb not merged yet.

@scottrigby
Copy link
Member

#8527 is merged 🎉

@Simon3
Copy link
Contributor

Simon3 commented Apr 1, 2019

Can anyone confirm (or disprove) that this issue also affects incubator/cassandra and would be fixed by #12402 ? Thanks!

@desaintmartin
Copy link
Collaborator Author

Thanks ! Yes, it should solve the problem.

srueg pushed a commit to appuio/charts that referenced this issue Jun 14, 2019
Otherwise updates are not possible. See this issue [1] for more details.

[1] helm/charts#7803

Signed-off-by: Simon Rüegg <simon.ruegg@vshn.ch>
beshkenadze added a commit to caesar-team/helm-charts that referenced this issue Jul 30, 2019
feikesteenbergen pushed a commit to timescale/helm-charts that referenced this issue Aug 22, 2019
…tadata.labels being immutable (#8594)

See helm/charts#7803

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
@schnrap
Copy link

schnrap commented Jan 16, 2020

We ran into the same issue in the stable/sonatype-nexus chart, when using the StatefulSet instead of the Deployment Option (statefulset.enabled=true).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants