-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add XValidation CRD marker for KEP-2876 support. #653
✨ Add XValidation CRD marker for KEP-2876 support. #653
Conversation
Welcome @benluddy! |
Hi @benluddy. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
0c468a9
to
7e083a3
Compare
/ok-to-test |
/lgtm |
This allows generation of the x-kubernetes-validations extension for expression-based validation rules.
7e083a3
to
b0d2867
Compare
👍 |
|
||
// Test of the expression-based validation rule marker, with optional message. | ||
// +kubebuilder:validation:XValidation:rule="self.size() % 2 == 0",message="must have even length" | ||
// +kubebuilder:validation:XValidation:rule="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way for us to check if the rule
contains a valid expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be practical to check that the expression is at least syntactically valid at generation time, but that would mean taking a dependency on a CEL parser.
The validity of a given expression depends simultaneously on the structure of the CEL expression itself and on where it sits within the schema, so it's complex enough that I'd be wary of rejecting a CRD at generation time that the API would have accepted.
Maybe we can revisit this question once x-k8s-validations graduates to beta (~1.25)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, by "valid expression" I meant syntastically valid, if it is also semantically valid is likely hard to tell and probably error prone. Deferring for now sgtm.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, benluddy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
* CRD Markers to include XValidation per this [Upstream PR](ihttps://github.com/kubernetes-sigs/pull/653) * Updated k8s.io/apiextensions-apiserver to v0.29.0 to per XValidation dependencies. Signed-off-by: soggiest <[email protected]>
This allows generation of the x-kubernetes-validations extension for
expression-based validation rules.