-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic in fake client when updating status with Unstructured resource #2493
Comments
/kind support bug |
Interesting, I'm trying to see if this is a change with reflect in go1.21. I thought we had a test with this case. // Before Go 1.21, ValueOf always escapes and a Value's content
// is always heap allocated.
// Set go121noForceValueEscape to true to avoid the forced escape,
// allowing Value content to be on the stack.
// Set go121noForceValueEscape to false for the legacy behavior
// (for debugging).
const go121noForceValueEscape = true
// ValueOf returns a new Value initialized to the concrete value
// stored in the interface i. ValueOf(nil) returns the zero Value.
func ValueOf(i any) Value {
if i == nil {
return Value{}
}
if !go121noForceValueEscape {
escapes(i)
}
return unpackEface(i)
} Thoughts @alvaroaleman ? I don't believe we are seeing this with go1.20 where controller-runtime is currently at. |
I also see the panic with go 1.20.8 and 1.19.13. The otherwise same environment works with controller-runtime 0.16.0 and 0.16.1. This is a regression in 0.16.2. |
The particular test case I have that is panicking is from reconciler-runtime.
Dependabot trying to bump the version https://github.com/vmware-labs/reconciler-runtime/actions/runs/6174150936/job/16758095601?pr=435#step:7:738 |
Gotcha, (not trying to blame it on the reflect but that changed and looking through the trace led me there). Also ^^ it wouldn't matter because that wasn't there before (what we added with reflect) to make that issue be the problem. I don't disagree with you that this may be a regression, just trying to understand the case where this test should've failed in my opinion which does the update on the I'm trying to reproduce this to better triage this issue but all feedback is welcomed. |
Took a stab at fixing the bug in #2495, along with a failing test. |
Thanks for reporting this and pushing up a fix so quickly. I'll look over it but the maintainers are probably gonna be the one to approve/lgtm, etc. |
There is a regression in 0.16.2 in the fake client when attempting to update a resource's status with an unstructured object.
In this case, the GVK has a type registered in the scheme, but the client is invoked using an unstructured object. The initial object was also defined as unstructured and converted to the typed resource inside the tracker.
The panic is triggered at
https://github.com/kubernetes-sigs/controller-runtime/blob/v0.16.2/pkg/client/fake/client.go#L407
obj
is the unstructured value passed toclient.Status().Update()
oldObject
is a typed value managed by the trackerThe two types are incompatible and cannot be reflectively assigned, at least not naively.
The text was updated successfully, but these errors were encountered: