Fix 3424 by avoiding a JSON round trip

This commit is contained in:
monopole
2021-01-08 17:26:33 -08:00
parent 497e8038a3
commit 14a1a0e4a8
4 changed files with 36 additions and 7 deletions

View File

@@ -4,6 +4,7 @@
package patchstrategicmerge
import (
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/yaml"
"sigs.k8s.io/kustomize/kyaml/yaml/merge2"
@@ -28,7 +29,9 @@ func (pf Filter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error) {
if err != nil {
return nil, err
}
result = append(result, r)
if !konfig.FlagEnableKyamlDefaultValue || r != nil {
result = append(result, r)
}
}
return result, nil
}