bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.93k stars 9.18k forks source link

Fail to update redis chart from v12.5.* to 12.6.* - nil pointer evaluating interface {}.labels error appeared #5197

Closed Brafgard closed 3 years ago

Brafgard commented 3 years ago

Which chart: bitnami/redis

Describe the bug Update from the chart from version 12.5. to 12.6. by helm upgrade command failed with error " Error: UPGRADE FAILED: template: redis/templates/redis-slave-statefulset.yaml:345:22: executing "redis/templates/redis-slave-statefulset.yaml" at <.Values.slave.statefulset.volumeClaimTemplates.labels>: nil pointer evaluating interface {}.labels "

To Reproduce 1) install redis chart v. 12.5.1 2) try to update it by helm upgrade redis redis --repo https://charts.bitnami.com/bitnami --version 12.6.0 --wait --reuse-values 3) error appeared "Error: UPGRADE FAILED: template: redis/templates/redis-slave-statefulset.yaml:345:22: executing "redis/templates/redis-slave-statefulset.yaml" at <.Values.slave.statefulset.volumeClaimTemplates.labels>: nil pointer evaluating interface {}.labels"

Expected behavior Upgrade from 12.5. to 12.6. version completed successfully.

Version of Helm and Kubernetes:

version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"clean", GoVersion:"go1.14.13"}
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.1", GitCommit:"206bcadf021e76c27513500ca24182692aabd17e", GitTreeState:"clean", BuildDate:"2020-09-09T11:26:42Z", GoVersion:"go1.15", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-16T20:43:08Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
dani8art commented 3 years ago

Hi @Brafgard, it seems it shouldn't fail if you are not overriding .Values.slave.statefulset..., are you? I mean default values always include:

slave:
  statefulset:
    labels: {}
    annotations: {}
    updateStrategy: RollingUpdate
    ## Partition update strategy
    ## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions
    # rollingUpdatePartition:
    volumeClaimTemplates:
      labels: {}
      annotations: {}

It should not fail, could you check it?

Brafgard commented 3 years ago

Hello! I have checked that - no overriding of statefulset from me. Here is the list of the VALUES _USER-SUPPLIED VALUES: containerSecurityContext: allowPrivilegeEscalation: false master: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution:

dani8art commented 3 years ago

Are you using --set or -f values.yaml to set those parameters?

Brafgard commented 3 years ago

Is it matter? :) For installation use ps1 script - inside^ $values = @" blabla "@ $values | helm install ...

dani8art commented 3 years ago

Is it matter?

I was trying to see if there is any difference when using --set or values.yaml but there isn't. My concern was about the merging strategy so it was doing the slave.statefulset.volumeClaimTemplates.labels was lost.

Regarding use --reuse-values, it seems to not be using the default values.yaml provided by the new chart version but the one used to install the first version so you are losing slave.statefulset.volumeClaimTemplates.labels default values.yaml

BTW, it could be fixed adding an extra if that check slave.statefulset.volumeClaimTemplates before using slave.statefulset.volumeClaimTemplates.labels. I'm going back to you soon with a PR fixing it

Brafgard commented 3 years ago

Thank you very much!

dani8art commented 3 years ago

Hi @Brafgard I've created a new PR trying to fix this problem, please, let's move the conversation there. Thanks so much for your feedback