24

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 }}
Filip Nikolov
  • 1,687
  • 15
  • 22
Ankit Sharma
  • 413
  • 1
  • 4
  • 9
  • How are you deploying this chart? Are you using `--set` parameter? Also how did you commented this line. Could you provide your YAMLs? Also could you share more about your environment? – PjoterS Sep 07 '20 at 07:18

2 Answers2

37

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.

Filip Nikolov
  • 1,687
  • 15
  • 22
0

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?

Anna Slastnikova
  • 1,260
  • 9
  • 9
  • Thanks @AnnaSlastnikova. But i would like to just use the sftp.yaml and not even consider the values.yaml (in the chart) just for .Values.allowedMACs. Is there a way to get this done using Go template? – Ankit Sharma Sep 07 '20 at 06:00