According to the structural schema, CRD schemas such as the one below (from the linked article) are allowed:
type: object
properties:
spec:
type: object
properties
command:
type: string
minLength: 1 # value validation
shell:
type: string
minLength: 1 # value validation
machines:
type: array
items:
type: string
pattern: “^[a-z0-9]+(-[a-z0-9]+)*$” # value validation
oneOf: # value validation
- required: [“command”] # value validation
- required: [“shell”] # value validation
As far as I can tell, it is not possible to generate a schema of this shape using controller-gen today. Specifically, the oneOf validation at the bottom cannot be represented using Kubebuilders validation annotations, as there is no way to specify oneOf (or anyOf/allOf/etc) via annotations that I can tell.
Is there a plan or vision for having controller-gen support more complex validation scenarios (or does it already and I've just missed how?)
According to the structural schema, CRD schemas such as the one below (from the linked article) are allowed:
As far as I can tell, it is not possible to generate a schema of this shape using controller-gen today. Specifically, the
oneOfvalidation at the bottom cannot be represented using Kubebuilders validation annotations, as there is no way to specifyoneOf(oranyOf/allOf/etc) via annotations that I can tell.Is there a plan or vision for having controller-gen support more complex validation scenarios (or does it already and I've just missed how?)