You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the XValidation marker is used on both a field and the type for that field the generated CRD is invalid because it tries to use an allOf property to merge the validations.
For example, given the definition of the following structs:
type FooSpec struct {
// +kubebuilder:validation:XValidation:rule="size(self.field) > 2",message="validation 1"
Thing Thing `json:"thing"`
}
// +kubebuilder:validation:XValidation:rule="has(self.field)",message="validation 2"
type Thing struct {
Field *string `json:"field"`
}
@jpbetz@cici37 Could you comment here whether you can foresee any issues with the way the allOf is being used presently with the CEL rules? In theory, as long as they are all executed it should behave as expected, but we were concerned whether this might break the cost estimation in some regard?
Joe Betz Cici Huang Could you comment here whether you can foresee any issues with the way the allOf is being used presently with the CEL rules? In theory, as long as they are all executed it should behave as expected, but we were concerned whether this might break the cost estimation in some regard?
When the
XValidation
marker is used on both a field and the type for that field the generated CRD is invalid because it tries to use anallOf
property to merge the validations.For example, given the definition of the following structs:
The generated CRD will include:
Where the expected result would have been:
I have a full reproduction of the bug including the invalid CRDs on https://github.com/cezarsa/validationbug/blob/a8148487551b92b4f3b6669cde9c4050e35cb98d/main.go.
The text was updated successfully, but these errors were encountered: