Unset/remove default value in helm values.yaml

Viewed 16444

I have a downloaded file through helm inspect called sftp.yaml

I have a parameter in that sftp.yaml file:-

sftp:
    allowedMACs: "hmac-sha2-512"
    allowedCiphers: aes256-ctr

Now if i install the corresponding helm chart after commenting out the entire line of "allowedMACs" from custom values files i.e. "sftp.yaml", then K8s takes the delta of sftp.yaml and the actual values.yaml and then use values.yaml's "allowedMACs".

However What i want is if "allowedMACs" line is commented in "sftp.yaml" custom values file, then it should not set the env variable at all, or sets it as null.

presently my deployment file's env section looks like

  - name: MACs
    value: {{ default "" .Values.sftp.allowedMACs | quote }}
2 Answers

You need to either override (with new value) or unset the value, if you only comment out the section you are not doing any of the above and the default value is going to be used.

Basically you are looking to unset a default value. As per banzaicloud example this can be done like so:

helm install stable/chart-name --set sftp.allowedMACs=null

You can also use override value file in a similar way:

sftp:
    allowedMACs: null
    allowedCiphers: aes256-ctr

This is available in Helm since version 2.6. If you like in-depth information you can review the issue and the subsequent PR that introduced the feature.

yeah I think helm would retrieve values from all values files, so if allowedMACs is in one of those it'll get populated. If this parameter is affected only by sftp.yaml file should it really belong only to it and would i make sense to remove it from main values.yaml?

Related