Add kunstruct impl of Get/SetDataMap, replace Resource.Merge

This commit is contained in:
jregan
2020-12-21 07:22:03 -08:00
parent 35087ed0cc
commit 735befef19
10 changed files with 280 additions and 48 deletions

View File

@@ -170,6 +170,39 @@ metadata:
`)
}
func TestGeneratorSimpleOverlay(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK("base", `
namePrefix: p-
configMapGenerator:
- name: cm
behavior: create
literals:
- fruit=apple
`)
th.WriteK("overlay", `
resources:
- ../base
configMapGenerator:
- name: cm
behavior: merge
literals:
- veggie=broccoli
`)
m := th.Run("overlay", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: v1
data:
fruit: apple
veggie: broccoli
kind: ConfigMap
metadata:
annotations: {}
labels: {}
name: p-cm-877mt5hc89
`)
}
func TestGeneratorOverlays(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK("/app/base1", `