helm: Values file key deletion doesn't work
I tried to use the feature to delete default keys (documented here) but it doesn’t work.
To test it I created a simple values.yaml file like this;
a: a
b: b
c: c
and a small template:
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data: |
{{- range $key, $value := .Values }}
{{ $key }} - {{ $value }}
{{- end }}
When I try to delete the “b” key like this helm install test-chart --debug --dry-run --set b=null I get this:
COMPUTED VALUES:
a: 1
b: "null"
c: 3
HOOKS:
MANIFEST:
---
# Source: test-chart/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test
data: |
a - 1
b - null
c - 3
I also tried grabbing the source code and looking at the values and I think I found what part of the problem is. In the “coalesceValues” method there is a check for value == nil (see here). According to the commit message it’s expecting the value to be nil at this point but what I found out is that the value is actually a string with the value “null”. So instead of deleting the key we actually end up using the key with a value of “null”
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 12
- Comments: 18 (6 by maintainers)
Commits related to this issue
- workaround https://github.com/helm/helm/issues/3117 — committed to ZigZagT/Networking by deleted user 6 years ago
@marespane I’m working on a series of patches that fix several bugs with the value merging behavior in pkg/chartutil
I’ve just hit this in both v2.9.1 and v2.10.0, this is still not working as described.
Result:
I tied setting an empty string instead, similar issue:
Result:
Trying to do this for a key which is a table yields:
I’m assuming it is the same root cause (
nullgets converted to a string, which of course is not a table), but just in case.I’ve hit this bug as well.
I’ve hit this bug as well. Think that issue is in how to give it nil value, hope it will be fixed soon.