You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
Repository navigation
This repository was 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
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.
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:
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.
Activity
desaintmartin commentedon Oct 2, 2018
ping @kocolosk @alexeyklyukin @linki
[incubator/patroni] Fix chart not being upgradable because of spec.Vo…
[incubator/patroni] Fix chart not being upgradable because of spec.Vo…
stale commentedon 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.
desaintmartin commentedon Nov 18, 2018
#8527 for couchdb not merged yet.
scottrigby commentedon Nov 22, 2018
#8527 is merged 🎉
fix: issue with statefulset on upgrades (see helm/charts#7803 for sim…
fix: issue with statefulset on upgrades (see helm/charts#7803 for rea…
[incubator/patroni] Fix chart not being upgradable because of spec.Vo…
Simon3 commentedon Apr 1, 2019
Can anyone confirm (or disprove) that this issue also affects incubator/cassandra and would be fixed by #12402 ? Thanks!
desaintmartin commentedon Apr 1, 2019
Thanks ! Yes, it should solve the problem.
Remove changing label from volumeClaimTemplate
Remove a label from the rabbitmq config file
Fix chart not being upgradable because of spec.VolumeClaimTemplate.me…
schnrap commentedon 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).