-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversion function is registered to copy of scheme #12683
Copy link
Copy link
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-priorityIndicates an issue lacks a `priority/foo` label and requires one.Indicates an issue lacks a `priority/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-priorityIndicates an issue lacks a `priority/foo` label and requires one.Indicates an issue lacks a `priority/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.
What steps did you take and what happened?
Similar to vmware-tanzu/vm-operator#1132
One of the example here
localSchemeBuilder is a copy, not a pointer to schemeBuilder.
While code here registers the func to the copy.
So the conversion functions in
RegisterConversionsare not actually registered.Server-side (apiserver) conversion webhook use Hub/Spoke pattern which delegates to Convert_* functions, but they do not use the scheme’s RegisterConversions automatically. So server side conversion doesn't get impacted, so this bug was never discovered.
This happens when someone tries to explicitly call the scheme.Convert() from client.
What did you expect to happen?
A simple replaceAll should do the work
Cluster API version
All
Kubernetes version
No response
Anything else you would like to add?
No response
Label(s) to be applied
/kind bug
One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.