Skip to content

Commit

Permalink
Merge pull request #3040 from natasha41575/fixIssue2896
Browse files Browse the repository at this point in the history
fixed issue 2896
  • Loading branch information
monopole committed Sep 30, 2020
2 parents bb42d8a + c93274c commit dd8edb1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion api/builtins/PatchTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/krusty/issue2896_test.go
Expand Up @@ -88,7 +88,7 @@ patches:
apiVersion: apps/v1
kind: Deployment
metadata:
name: example
name: example-test-api
spec:
template:
spec:
Expand Down
8 changes: 7 additions & 1 deletion plugin/builtin/patchtransformer/PatchTransformer.go
Expand Up @@ -143,9 +143,15 @@ func (p *plugin) applySMPatch(resource, patch *resource.Resource) error {
if err != nil {
return err
}
return filtersutil.ApplyToJSON(patchstrategicmerge.Filter{
n, ns := resource.GetName(), resource.GetNamespace()
err = filtersutil.ApplyToJSON(patchstrategicmerge.Filter{
Patch: node,
}, resource)
if len(resource.Map()) != 0 {
resource.SetName(n)
resource.SetNamespace(ns)
}
return err
}

// transformJson6902 applies the provided json6902 patch
Expand Down

0 comments on commit dd8edb1

Please sign in to comment.