Repository navigation
Disallow repeaded CORS filters by CEL - #4639
k8s-ci-robot merged 1 commit into
Conversation
|
Hi @DamianSawicki. 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 Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
a03f365 to
f9e7244
Compare
|
/cc @snorwin |
|
/ok-to-test good catch! |
|
@rikatz: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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-sigs/prow repository. |
| // +kubebuilder:validation:XValidation:message="ResponseHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'ResponseHeaderModifier').size() <= 1" | ||
| // +kubebuilder:validation:XValidation:message="RequestRedirect filter cannot be repeated",rule="self.filter(f, f.type == 'RequestRedirect').size() <= 1" | ||
| // +kubebuilder:validation:XValidation:message="URLRewrite filter cannot be repeated",rule="self.filter(f, f.type == 'URLRewrite').size() <= 1" | ||
| // +kubebuilder:validation:XValidation:message="CORS filter cannot be repeated",rule="self.filter(f, f.type == 'CORS').size() <= 1" |
There was a problem hiding this comment.
one thing: CEL validation on CRD is prone to alphabetical order, so you should move this above on line 253 before RequestHeaderModifier
There was a problem hiding this comment.
Interesting! Haven't checked the entire file, but the tests containing my changes were passing in my IDE. Will fix!
There was a problem hiding this comment.
Done.
Out of curiosity, why the following order is correct? Is the alphabetical order based on rule rather than message?
// +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))"
// +kubebuilder:validation:XValidation:message="CORS filter cannot be repeated",rule="self.filter(f, f.type == 'CORS').size() <= 1"
// +kubebuilder:validation:XValidation:message="RequestHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'RequestHeaderModifier').size() <= 1"
good catch!
It's Norwin's :)
f9e7244 to
c7cc81a
Compare
This is in line with how we disallow other repeated filters. Signed-off-by: Damian Sawicki <dsawicki@google.com>
c7cc81a to
30cec8f
Compare
|
/retest |
|
@DamianSawicki thanks for fixing this! Can you add a release note to the PR since it is technically an API change? /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DamianSawicki, robscott The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm Thanks for this @DamianSawicki! |
|
@rikatz: new pull request created: #4645 DetailsIn response to this:
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-sigs/prow repository. |
This is in line with how we disallow other repeated filters. Signed-off-by: Damian Sawicki <dsawicki@google.com>
What type of PR is this?
/kind bug
What this PR does / why we need it:
The CEL validation rule present for other filter types has been missing for CORS.
Which issue(s) this PR fixes:
Does this PR introduce a user-facing change?: