Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Unable to upgrade due to spec.selector.matchLabels changing #86

Closed
kenXengineering opened this issue Dec 11, 2018 · 3 comments · Fixed by #113
Closed

Unable to upgrade due to spec.selector.matchLabels changing #86

kenXengineering opened this issue Dec 11, 2018 · 3 comments · Fixed by #113

Comments

@kenXengineering
Copy link

I am attempting to upgrade our consul install from chart 0.1.0 to 0.4.0 and am receiving the following error messages:

Error: UPGRADE FAILED: DaemonSet.apps "consul" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"consul", "chart":"consul-0.4.0", "component":"client", "hasDNS":"true", "release":"consul"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable 
&& StatefulSet.apps "consul-server" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden.

Looks like the lable chart is being updating from consul-0.1.0 to consul-0.4.0, which seems to be the norm. However this is causing the spec.selector.matchLabels.chart section in the StatefulSet and DaemonSet to change, which is an immutable field. I was able to get around this issue by changing the chart version back to 0.1.0 in the Chart.yaml file.

I think we should remove the chart label from any label selectors as this value will change with chart upgrades.

@matkam
Copy link

matkam commented Feb 20, 2019

Is there an upgrade path now that the chart label is consul-helm? As a workaround, I had to modify templates/_helpers.tpl file to replace %s-helm with %s-0.1.0

@adilyse
Copy link
Contributor

adilyse commented Feb 28, 2019

@matkam To take advantage of this fix, you'll likely need to delete your previous Helm installation and install things again with the update. Once you've done that, though, it should be possible to do direct upgrades from Helm since we're no longer trying to change an immutable field.

@matkam
Copy link

matkam commented Apr 25, 2019

@adilyse is there a way to upgrade without deleting the existing consul cluster? I'm seeing a similar error when changing the server replicas, so it may be time for a redeployment:

Error: UPGRADE FAILED: PodDisruptionBudget.policy "my-1-consul-server" is invalid: spec: Forbidden: updates to poddisruptionbudget spec are forbidden.

I just don't want to lose data or disrupt services that rely on Consul.

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

Successfully merging a pull request may close this issue.

3 participants