-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Putting chart version in metadata.labels in a Deployment v1beta1 without selector prevents upgrade #7726
Comments
Hi @desaintmartin Thanks again for working to unpack these related issues. Just to disambiguate these two issues, are you essentially saying this?
If so, should we clarify this in #7692? And can this issue should clarify this line in the "Conclusion":
For this issue (resources in |
Hey @scottrigby, just helping! Let me clarify the conclusion by clearly separating the two problems, i.e what should be done now ( Regarding #7692, I didn't want to get into the details of "why" but let's try, let's continue there for this part of the discussion. |
This is required to work around helm/charts#7726
This is required to work around helm/charts#7726
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. |
Have all charts been updated? Can we close this? |
Charts owned by Bitnami were updated |
See #7726. Signed-off-by: Cédric de Saint Martin <[email protected]>
I've also encountered this issue in the |
It is related to #7680 to be exact, thanks for reporting. |
MongoDB chart was fixed on this PR: #10121 |
See helm#7726. Signed-off-by: Cédric de Saint Martin <[email protected]>
We can close this issue because we have the correct way to handle this documented in the Names and Labels section of the REVIEW_GUIDELINES. If we want to automate checking for this, we should add to https://github.com/helm/chart-testing 😄 |
BUG REPORT
Any Chart containing Deployment/StatefulSet/DaemonSet apps/v1beta1 or extensions/v1beta1 without
spec.selector
using a chart version inmetadata.labels
can't be upgraded.Note:
This is the first bug among 3 regarding "I can't upgrade my Release".
For the apps/v1beta2 problem, see #7680.
For the immutable volumeClaimTemplate in StatefulSet (any version), see #7803
From the k8s documentation
in Deployment/StatefulSet/DaemonSet apps/v1beta1 or extensions/v1beta1, spec.selector is not mandatory.
If it is not specified, it is generated from
spec.metadata.labels
Source: Official documentation: https://v1-7.docs.kubernetes.io/docs/concepts/workloads/controllers/deployment/
Impacted charts
Probably all of https://github.com/helm/charts/pulls?utf8=%E2%9C%93&q=is%3Apr+%22Add+chart+and+release+labels+in+pods%22+
How to reproduce (using stable/dokuwiki as an example)
Let's install the stable/dokuwiki 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:
Because of metadata.labels in templates/deployment.yaml containing:
chart: {{ template "dokuwiki" . }}
It will fail with:
I think it comes from the fact that during the initial installation, k8s generated the selector, but during upgrade, both helm and k8s ignore it.
But putting an explicit selector, even if it contains a
chart
label, will make it upgradable:It works!
Conclusion
chart
label although it would be not wise as it would break compatibility forapps/v1beta2
and later (see Putting chart version in spec.selector.matchLabels in apps/v1beta2 and later prevents ANY future upgrade of existing Release #7680 )spec.template.metadata.labels
are not impacted.Thankfully, this can be solved using a minor version change.
The text was updated successfully, but these errors were encountered: