Fix coalesce globals to prevent subchart globals to leak upstream

Signed-off-by: Giacomo Margaria <giacomo.margaria@gmail.com>
pull/9756/head
Giacomo Margaria 3 years ago
parent db4d20f3ad
commit 3b68afc1c8

@ -127,9 +127,10 @@ func coalesceGlobals(dest, src map[string]interface{}) {
// It's not clear if this condition can actually ever trigger.
log.Printf("key %s is table. Skipping", key)
continue
} else {
// TODO: Do we need to do any additional checking on the value?
dg[key] = val
}
// TODO: Do we need to do any additional checking on the value?
dg[key] = val
}
dest[GlobalKey] = dg
}

@ -87,6 +87,9 @@ func TestCoalesceValues(t *testing.T) {
&chart.Chart{
Metadata: &chart.Metadata{Name: "ahab"},
Values: map[string]interface{}{
"global": map[string]interface{}{
"nested": map[string]interface{}{"foo": "bar"},
},
"scope": "ahab",
"name": "ahab",
"boat": true,
@ -135,9 +138,11 @@ func TestCoalesceValues(t *testing.T) {
{"{{.pequod.ahab.scope}}", "whale"},
{"{{.pequod.ahab.nested.foo}}", "true"},
{"{{.pequod.ahab.global.name}}", "Ishmael"},
{"{{.pequod.ahab.global.nested.foo}}", "bar"},
{"{{.pequod.ahab.global.subject}}", "Queequeg"},
{"{{.pequod.ahab.global.harpooner}}", "Tashtego"},
{"{{.pequod.global.name}}", "Ishmael"},
{"{{.pequod.global.nested.foo}}", "<no value>"},
{"{{.pequod.global.subject}}", "Queequeg"},
{"{{.spouter.global.name}}", "Ishmael"},
{"{{.spouter.global.harpooner}}", "<no value>"},

Loading…
Cancel
Save