mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 02:11:20 +00:00
Fix 3424 by avoiding a JSON round trip
This commit is contained in:
@@ -10,10 +10,12 @@ import (
|
||||
|
||||
"sigs.k8s.io/kustomize/api/filters/patchstrategicmerge"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/internal/wrappy"
|
||||
"sigs.k8s.io/kustomize/api/resid"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/filtersutil"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
kyaml "sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
@@ -437,6 +439,14 @@ func (r *Resource) ApplySmPatch(patch *Resource) error {
|
||||
}
|
||||
|
||||
func (r *Resource) ApplyFilter(f kio.Filter) error {
|
||||
if wn, ok := r.kunStr.(*wrappy.WNode); ok {
|
||||
l, err := f.Filter([]*kyaml.RNode{wn.AsRNode()})
|
||||
if len(l) == 0 {
|
||||
// Hack to deal with deletion.
|
||||
r.kunStr = wrappy.NewWNode()
|
||||
}
|
||||
return err
|
||||
}
|
||||
return filtersutil.ApplyToJSON(f, r)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user