Overview
Releases v0.12.0
and (potentially) v0.13.1
are breaking releases. If following SemVer, these should have been v1.0.0
and v2.0.0
respectively. Typically a CHANGELOG would exist with Upgrade notes.
Ideally, to resolve this issue, a CHANGELOG.md
should exist that clearly shows changes made and potential breaking changes, along with special upgrade notes.
Upgrading to v0.12.0
:
This is the same issue as #28 but wanted to add more details. When upgrading to v0.12.0
, you'll likely face the following errors:
Error: cannot patch "<release-name>-democratic-csi-node" with kind DaemonSet: DaemonSet.apps "<release-name>-democratic-csi-node" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"node-linux", "app.kubernetes.io/csi-role":"node", "app.kubernetes.io/instance":"<release-name>", "app.kubernetes.io/managed-by":"Helm", "app.kubernetes.io/name":"democratic-csi"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable && cannot patch "<release-name>-democratic-csi-controller" with kind Deployment: Deployment.apps "<release-name>-democratic-csi-controller" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"controller-linux", "app.kubernetes.io/csi-role":"controller", "app.kubernetes.io/instance":"<release-name>", "app.kubernetes.io/managed-by":"Helm", "app.kubernetes.io/name":"democratic-csi"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
and
Error: cannot patch "<release-name>-democratic-csi-controller" with kind Deployment: Deployment.apps "<release-name>-democratic-csi-controller" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"controller-linux", "app.kubernetes.io/csi-role":"controller", "app.kubernetes.io/instance":"<release-name>", "app.kubernetes.io/managed-by":"Helm", "app.kubernetes.io/name":"democratic-csi"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
To resolve, you need to delete the DaemonSet and Deployment for the respective pods. To do this, run:
kubectl delete deployment --namespace <your_namespace> <release-name>-democratic-csi-controller
kubectl delete ds --namespace <your_namespace> <release-name>-democratic-csi-node
Now you should be able to successfully run your helm upgrade command.
Upgrading to v0.13.1
This one isn't exactly the fault of the Helm chart but more so K8s. In v0.13.1
, the CRD was removed (issue #18 & #24) due to its incompatibility with K8s >v1.21. But CRDs are not automatically removed (or updated) and manual intervention is required. As such, you may run into the following error:
Error: current release manifest contains removed kubernetes api(s) for this kubernetes version and it is therefore unable to build the kubernetes objects for performing the diff. error from kubernetes: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
The easiest way to resolve this issue is by using the Helm MapKubeAPIs plugin.
helm mapkubeapis --namespace <your_namespace> <release-name>
Conclusion
I hope this helps other folks that ran into these issues and notes like above end-up documented somewhere (CHANGELOG, README, etc.)