prometheus-community / helm-charts

Prometheus community Helm charts
Apache License 2.0
5.01k stars 5k forks source link

Kube-state-metrics - broken upgrade due to label selector change #2013

Closed vishiy closed 2 years ago

vishiy commented 2 years ago

Describe the bug a clear and concise description of what the bug is.

When upgrading from chart version 3.5.2 to 4.7.0, upgrade fails due to selector labels being changed from 3.5.2 to 4.7.0.

3.5.2 chart -- selector: matchLabels: app.kubernetes.io/name: kube-state-metrics

4.7.0 chart -- selector: matchLabels: app.kubernetes.io/instance: <releasename> app.kubernetes.io/name: kube-state-metrics

This breaks upgrade.

What's your helm version?

version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"clean", GoVersion:"go1.17.5"}

What's your kubectl version?

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:10:45Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.6", GitCommit:"07959215dd83b4ae6317b33c824f845abd578642", GitTreeState:"clean", BuildDate:"2022-03-30T18:28:25Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

Which chart?

kube-state-metrics

What's the chart version?

4.7.0

What happened?

When upgrading from chart version 3.5.2 to 4.7.0, upgrade fails due to selector labels being changed from 3.5.2 to 4.7.0.

What you expected to happen?

Upgrade successfully.

How to reproduce it?

No response

Enter the changed values of values.yaml?

No response

Enter the command that you execute and failing/misfunctioning.

-

Anything else we need to know?

No response

stale[bot] commented 2 years ago

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.

vishiy commented 2 years ago

-

dotdc commented 2 years ago

Hi @vishiy, This is because this field is Immutable, Kubernetes will not let you change it and would be the same using kubectl. Didn't find an official doc pointer, but this explains it: https://www.datree.io/resources/kubernetes-error-codes-field-is-immutable Unfortunately, the only solution here is to delete/recreate the deployment. Will close this issue because there is nothing we can do here.