Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
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

Closed

Description

@desaintmartin

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

Activity

  1. desaintmartin commented on Oct 2, 2018

    @desaintmartin
    CollaboratorAuthor
  2. stale commented on Nov 18, 2018

    @stale

    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.

  3. added
    lifecycle/stale
    and removed
    lifecycle/stale
    on Nov 18, 2018
  4. desaintmartin commented on Nov 18, 2018

    @desaintmartin
    CollaboratorAuthor

    #8527 for couchdb not merged yet.

  5. scottrigby commented on Nov 22, 2018

    @scottrigby
    Member

    #8527 is merged 🎉

  6. Simon3 commented on Apr 1, 2019

    @Simon3
    Contributor

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

  7. desaintmartin commented on Apr 1, 2019

    @desaintmartin
    CollaboratorAuthor

    Thanks ! Yes, it should solve the problem.

  8. schnrap commented on Jan 16, 2020

    @schnrap

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions