diff --git a/pkg/kinflate/commands/testdata/simple/out/expected.yaml b/pkg/kinflate/commands/testdata/simple/out/expected.yaml index 5f79971c6..9eaa3387c 100644 --- a/pkg/kinflate/commands/testdata/simple/out/expected.yaml +++ b/pkg/kinflate/commands/testdata/simple/out/expected.yaml @@ -77,7 +77,7 @@ metadata: foo: bar org: kubernetes repo: test-infra - name: test-infra-mungebot + name: test-infra-baseprefix-mungebot spec: replicas: 2 selector: diff --git a/pkg/kinflate/util.go b/pkg/kinflate/util.go index 937de0a04..ce9f6c1af 100644 --- a/pkg/kinflate/util.go +++ b/pkg/kinflate/util.go @@ -254,6 +254,9 @@ func manifestToMap(m *manifest.Manifest, return nil, err } } + // Store the name of the base object, because this name may have been munged. + // Apply this name to the StrategicMergePatched object. + baseName := base.GetName() merged, err := strategicpatch.StrategicMergeMapPatch( base.UnstructuredContent(), overlay.UnstructuredContent(), @@ -261,6 +264,7 @@ func manifestToMap(m *manifest.Manifest, if err != nil { return nil, err } + base.SetName(baseName) baseResourceMap[gvkn].Object = merged delete(overlayResouceMap, gvkn) }