improve target in JSON6902 transformer

This commit is contained in:
Donny Xia
2020-11-03 17:13:43 -08:00
parent d8d57eae29
commit 3b79944190
5 changed files with 22 additions and 72 deletions

View File

@@ -55,7 +55,7 @@ type Kustomization struct {
// JSONPatches is a list of JSONPatch for applying JSON patch.
// Format documented at https://tools.ietf.org/html/rfc6902
// and http://jsonpatch.com
PatchesJson6902 []PatchJson6902 `json:"patchesJson6902,omitempty" yaml:"patchesJson6902,omitempty"`
PatchesJson6902 []Patch `json:"patchesJson6902,omitempty" yaml:"patchesJson6902,omitempty"`
// Patches is a list of patches, where each one can be either a
// Strategic Merge Patch or a JSON patch.
@@ -172,9 +172,7 @@ func (k *Kustomization) FixKustomizationPostUnmarshalling() {
// has been processed.
func (k *Kustomization) FixKustomizationPreMarshalling() {
// PatchesJson6902 should be under the Patches field.
for _, patch := range k.PatchesJson6902 {
k.Patches = append(k.Patches, patch.ToPatch())
}
k.Patches = append(k.Patches, k.PatchesJson6902...)
k.PatchesJson6902 = nil
}