Merge pull request #9756 from codeJack/fix-issue-9749

Fix coalesce globals to prevent subchart globals to leak upstream
pull/9748/merge
Martin Hickey 4 years ago committed by GitHub
commit e87f815637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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