Commit 645f01eb authored by Scott Rigby's avatar Scott Rigby

New Helm functionality to delete a coalesced YAML key when the value is nil.

- Note that this covers all YAML null syntax options:
  ref: http://yaml.org/type/null.html
- Note that we do a nil comparison because the encoding/yaml package parses
  YAML properly and any variation of null, Null, NULL, or ~ is converted to nil
  by the time we get here.
parent 099790a0
...@@ -281,6 +281,13 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf ...@@ -281,6 +281,13 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf
if _, ok := v[key]; !ok { if _, ok := v[key]; !ok {
// If the key is not in v, copy it from nv. // If the key is not in v, copy it from nv.
v[key] = val v[key] = val
} else if ok && v[key] == nil {
// When the YAML value is null, we remove the value's key.
// This allows Helm's various sources of values (value files or --set) to
// remove incompatible keys from any previous chart, file, or set values.
// ref: http://www.yaml.org/spec/1.2/spec.html#id2803362
delete(v, key)
continue
} else if dest, ok := v[key].(map[string]interface{}); ok { } else if dest, ok := v[key].(map[string]interface{}); ok {
// if v[key] is a table, merge nv's val table into v[key]. // if v[key] is a table, merge nv's val table into v[key].
src, ok := val.(map[string]interface{}) src, ok := val.(map[string]interface{})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment