[KUBE] Use Schemaless for Objects that can be Unmarshaled as string or struct
spolti opened this issue · 0 comments
spolti commented
What would you like to be added:
Kubernetes Kubebuilder code generator is not able to handle union tag which handles the oneOf definition that allows us to define which types a struct accepts two types, example, string and boolean.
More information on kubernetes-sigs/controller-tools#298
One option to overcome this problem is defining the affect struct as schemaless and delegate the workflow validation to the admission webhook.
E..g:
// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
Object *CustomObj `json:"object,omitempty"`
This way, this field can be defined as Schemaless and will accept any value.
Why is this needed:
To be able to smoothly integrate the sdk with Kubernetes.