Merge pull request #249 from mengqiy/fix_nameprefix_overlay

fix a bug of nameprefix lost after applying patch
This commit is contained in:
k8s-ci-robot 2018-02-05 09:28:11 -08:00 committed by GitHub
commit 759c3f9e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

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

View File

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