patches cause an error with $patch:delete in files with multiple patches #5552
Labels
kind/bug
Categorizes issue or PR as related to a bug.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
What happened?
patchesStrategicMerge was used for include a code that declare $path:delete in patches for rewrite output from bases and granually including some structure per environment (after initial declaration in bases)
After Kustomize version was upgraded kustomize from 4.5.x to 5.3.0 and upgrading to patches from patchesStrategicMerge it cause an error in a files multiple patches with $patch:delete
What did you expect to happen?
Running the command "kustomize build ./overlay/test" shows resources that have not been disabled for overlays.
How can we reproduce it (as minimally and precisely as possible)?
Run this in terminal or with a bash file and check output with patches and patchesStrategicMerge
Expected output
a proper output with workflow-suffix3 deployment declaration
Actual output
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x9902cb]
goroutine 1 [running]:
sigs.k8s.io/kustomize/kyaml/yaml.(*RNode).Content(...)
sigs.k8s.io/kustomize/kyaml/yaml/rnode.go:707
sigs.k8s.io/kustomize/kyaml/yaml.(*RNode).getMapFieldValue(0x14002260b08?, {0x10476bfb1?, 0x7?})
sigs.k8s.io/kustomize/kyaml/yaml/rnode.go:420 +0x54
sigs.k8s.io/kustomize/kyaml/yaml.(*RNode).GetApiVersion(...)
sigs.k8s.io/kustomize/kyaml/yaml/rnode.go:402
sigs.k8s.io/kustomize/kyaml/resid.GvkFromNode(0x140017648b8?)
sigs.k8s.io/kustomize/kyaml/resid/gvk.go:32 +0x40
sigs.k8s.io/kustomize/api/resource.(*Resource).GetGvk(...)
sigs.k8s.io/kustomize/api/resource/resource.go:57
sigs.k8s.io/kustomize/api/resource.(*Resource).CurId(0x1400044e960)
Kustomize version
kustomize 5.3.0
Operating system
Linux
The text was updated successfully, but these errors were encountered: