Is your feature request related to a problem or existing issue? Please describe.
As discussed with @ajaysundark in PR #418:
Currently, some configuration constraints for the bootstrap-only enforcement mode are implemented in the Go admission webhook rather than natively via CRD CEL validation (+kubebuilder:validation:XValidation).
The constraints currently living in the webhook are:
- defaultStatus should not be used with bootstrap-only mode.
- anyOf conditionPolicy is not supported with bootstrap-only mode.
Describe the solution you'd like
To move closer to our goal of eventually deprecating and removing the validating webhook entirely in favor of native Kubernetes CEL, we should migrate the remaining bootstrap-only validations to CEL expressions on the NodeReadinessRuleSpec.
We can enforce these natively by adding the following XValidation markers:
// +kubebuilder:validation:XValidation:rule="!has(self.enforcementMode) || self.enforcementMode != 'bootstrap-only' || !has(self.conditionPolicy) || self.conditionPolicy != 'anyOf'",message="anyOf conditionPolicy is not supported with bootstrap-only enforcementMode"
// +kubebuilder:validation:XValidation:rule="!has(self.enforcementMode) || self.enforcementMode != 'bootstrap-only' || !has(self.conditions) || self.conditions.all(c, !has(c.defaultStatus))",message="defaultStatus should not be used with bootstrap-only enforcementMode"
Once these are added and tested, the corresponding Go validation logic and unit tests can be cleanly removed from internal/webhook/nodereadinessgaterule_webhook.go.
Describe alternatives you've considered
N/A
Is your feature request related to a problem or existing issue? Please describe.
As discussed with @ajaysundark in PR #418:
Currently, some configuration constraints for the bootstrap-only enforcement mode are implemented in the Go admission webhook rather than natively via CRD CEL validation (+kubebuilder:validation:XValidation).
The constraints currently living in the webhook are:
Describe the solution you'd like
To move closer to our goal of eventually deprecating and removing the validating webhook entirely in favor of native Kubernetes CEL, we should migrate the remaining bootstrap-only validations to CEL expressions on the NodeReadinessRuleSpec.
We can enforce these natively by adding the following XValidation markers:
Once these are added and tested, the corresponding Go validation logic and unit tests can be cleanly removed from
internal/webhook/nodereadinessgaterule_webhook.go.Describe alternatives you've considered
N/A