-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.kind/supportCategorizes issue or PR as a support question.Categorizes issue or PR as a support question.
Description
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 tracker
The two types are incompatible and cannot be reflectively assigned, at least not naively.
panic: reflect.Set: value of type v1.MyResource is not assignable to type unstructured.Unstructured [recovered]
panic: reflect.Set: value of type v1.MyResource is not assignable to type unstructured.Unstructured
goroutine 12 [running]:
testing.tRunner.func1.2({0x105d91e20, 0x140004cc010})
/opt/homebrew/Cellar/go/1.21.1/libexec/src/testing/testing.go:1545 +0x370
testing.tRunner.func1()
/opt/homebrew/Cellar/go/1.21.1/libexec/src/testing/testing.go:1548 +0x528
panic({0x105d91e20?, 0x140004cc010?})
/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x254
reflect.Value.assignTo({0x105f00420, 0x14000100900, 0x199}, {0x105b0d7e6, 0xb}, 0x105e6d040, 0x0)
/opt/homebrew/Cellar/go/1.21.1/libexec/src/reflect/value.go:3307 +0x340
reflect.Value.Set({0x105e6d040, 0x14000683588, 0x199}, {0x105f00420, 0x14000100900, 0x199})
/opt/homebrew/Cellar/go/1.21.1/libexec/src/reflect/value.go:2260 +0xa8
sigs.k8s.io/controller-runtime/pkg/client/fake.versionedTracker.update({{0x1060581a0, 0x140000a0370}, 0x140002885b0, 0x1400007fe30}, {{0x1400069dde0, 0x1a}, {0x1400069ddfb, 0x2}, {0x140001ae220, 0xd}}, ...)
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/client/fake/client.go:407 +0x938
sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeClient).update(0x140000a03c0, {0x10605dd18, 0x14000683588}, 0x1, {0x14000356dc0, 0x1, 0x1})
/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/client/fake/client.go:789 +0x46c
sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeSubResourceClient).Update(0x14000516f18, {0x106054c50, 0x14000024c30}, {0x10605dd18, 0x14000683588}, {0x0, 0x0, 0x0})
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.kind/supportCategorizes issue or PR as a support question.Categorizes issue or PR as a support question.