controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

admission.Decoder.Decode is panicking after version bump

Open mahmud2011 opened this issue 1 year ago • 3 comments

I updated controller-runtime from v0.14.4 to v0.15.3 along with k8s.io/* from v0.26.2 to v0.27.7.

type PodMut struct {
    decoder        *admission.Decoder
    ...
}


func (pm *PodMut) Handle(ctx context.Context, req admission.Request) admission.Response {
	pod := &corev1.Pod{}
	err := pm.decoder.Decode(req, pod)
        ...
}
runtime error: invalid memory address or nil pointer dereference

/usr/local/go/src/runtime/panic.go:920 +0x270
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Decoder).DecodeRaw(0x0, {{0xc000018b00, 0x2049, 0x2529}, {0x0, 0x0}}, {0x1a42b72, 0xc000229690})

I don't see any breaking changes for this in release log. I also inspected the dump using spew couldn't figure out why it's panicking.

mahmud2011 avatar Feb 22 '24 17:02 mahmud2011