Repository navigation
Conversation
3749249 to
c7c15cb
Compare
78f63d5 to
3741f38
Compare
d9853ff to
17a72ed
Compare
17a72ed to
ec915d4
Compare
ec915d4 to
2224375
Compare
2224375 to
60e3819
Compare
juliocamarero
left a comment
There was a problem hiding this comment.
LGTM. I wasn't aware of the CEL validations, but they seem very expressive and easy to use, I like this approach 👍
SgtCoDFish
left a comment
There was a problem hiding this comment.
Seeing the amount of code this removes is super cool 🚀 I've got a few questions to help me understand better!
| // data to. | ||
| // +kubebuilder:validation:XValidation:rule="[has(self.configMap), has(self.secret)].exists(x,x)", message="must define at least one target configMap/secret" | ||
| // +kubebuilder:validation:XValidation:rule="!has(self.additionalFormats) || ![has(self.additionalFormats.jks), has(self.additionalFormats.pkcs12)].all(x,x) || self.additionalFormats.jks.key != self.additionalFormats.pkcs12.key", message="additional format keys must be unique" | ||
| // +kubebuilder:validation:XValidation:rule="!has(self.additionalFormats) || !((has(self.configMap) ? [self.configMap.key] : []) + (has(self.secret) ? [self.secret.key] : [])).exists(k,(has(self.additionalFormats.jks) && self.additionalFormats.jks.key == k) || (has(self.additionalFormats.pkcs12) && self.additionalFormats.pkcs12.key == k))", message="additional format keys must be different from configMap/secret keys" |
There was a problem hiding this comment.
question: Is a +kubebuilder comment the only way of specifying these validation rules? (I'm unfamiliar generally with this CEL validation stuff)
This CEL code is super important to our UX but it's really difficult to read, understand and test it when it's embedded in a comment like this - seems like a sharp edge.
This isn't a blocker or anything, but it seems a shame if this is the only way today!
There was a problem hiding this comment.
No, it should be possible to hack the expression directly into the CRDs, but that is not something I would do. 😆 The expressions are mainly complex because the API is suboptimal. After #486, I think the expressions could become really simple.
Thanks for reviewing @SgtCoDFish (and @juliocamarero)! But I think the best option here is to put this PR back into draft-mode and wait for a conclusion on #486.
2af5468 to
77d7646
Compare
|
/remove-lifecycle stale |
77d7646 to
c1f4cac
Compare
|
/test all |
c1f4cac to
9a61a64
Compare
9a61a64 to
4723461
Compare
|
/test pull-trust-manager-test |
Signed-off-by: Erik Godding Boye <[email protected]>
4723461 to
dd692e0
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: juliocamarero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
PR needs rebase. DetailsInstructions 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-sigs/prow repository. |
|
CEL validations are great, but it seems like we should introduce them when the API is improved. Closing in favor of #664. |
I want to see if it's possible to remove the trust-manager validating webhook, as it will eliminate the requirement to pre-install cert-manager. But it doesn't seem possible, at least not with the current Bundle API, to fully replace the webhook validations with CEL api-server validation. We might get a bit further after redesigning the
targetstructure ref. #242, but the label selectors require a webhook to be validated AFAIK.I personally think the CEL validations are more compact and fairly easy to read, at least the common union validations. The additional formats validation CEL expression is probably a bit over the line, so I am open to reverting it. But I wanted to see how far I could get with CEL, and I even got assistance from Jordan Liggit himself! 🦄
Jordan suggested optional fields to reduce the complexity, but I decided to avoid them for now - since that will require Kubernetes version >= 1.29 to work. We can simplify later on.
It would be super nice to replace our validating webhook with CRD CEL validations completely, but that seems currently impossible. The remaining validations done by the validating webhook include:
Please let me know what you think!
/cc @juliocamarero @SgtCoDFish @inteon