apimachinery's unstructured converter panics if the destination struct contains private fields #124154
Labels
kind/bug
Categorizes issue or PR as related to a bug.
sig/api-machinery
Categorizes an issue or PR as relevant to SIG API Machinery.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What happened?
Using the DefaultUnstructuredConverter with a destination struct containing a non-exported field throws a panic.
I might be in a specific edge case, but we use protobuf to generate gRPC structs. Those structs contain private fields holding the grpc state and cause the converter to panic, even if the unstructured object only contains the public user-facing fields.
What did you expect to happen?
I would expect the converter to ignore private fields and not panic.
How can we reproduce it (as minimally and precisely as possible)?
Anything else we need to know?
I can send a PR if you confirm this should be fixed and that the fix is to skip the private fields.
Kubernetes version
The go module looks like
Cloud provider
No cloud provider.
OS version
No response
Install tools
Go 1.22
Container runtime (CRI) and version (if applicable)
No response
Related plugins (CNI, CSI, ...) and versions (if applicable)
No response
The text was updated successfully, but these errors were encountered: