-
Notifications
You must be signed in to change notification settings - Fork 493
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
validation: take parentRef.port into account #1995
validation: take parentRef.port into account #1995
Conversation
Currently, we cannot have: ```yaml parentRefs: - name: gw1 port: 80 - name: gw1 port: 8080 ``` This seems like an oversight; our validation only takes sectionName into consideration. Note: this DOES allow overlapping parentSection selection. For exampe, i may select port=80 and sectionName=http which refer to the same thing. This is not something we can catch in validation. Perhaps we need to clarify the behavior here in the spec, if its not clear. Note this could always happen with 2 different routes anyways, though.
077f890
to
b9228d9
Compare
/lgtm |
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.
Thanks @howardjohn! Mostly LGTM, but would be helpful to have one more test case.
00841bd
to
ac4a2fb
Compare
apis/v1beta1/validation/common.go
Outdated
if len(s[0]) == 0 || len(*targetSection) == 0 { | ||
errs = append(errs, field.Required(path.Child("parentRefs"), "sectionNames must be specified when more than one parentRef refers to the same parent")) | ||
if s.UnsortedList()[0] == (parentQualifier{}) || pq == (parentQualifier{}) { | ||
errs = append(errs, field.Required(path.Child("parentRefs"), "sectionNames or port must be specified when more than one parentRef refers to the same parent")) |
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.
errs = append(errs, field.Required(path.Child("parentRefs"), "sectionNames or port must be specified when more than one parentRef refers to the same parent")) | |
errs = append(errs, field.Required(path.Child("parentRefs"), "sectionNames or ports must be specified when more than one parentRef refers to the same parent")) |
LGTM, but a small typo. @howardjohn Thanks! |
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.
Thanks @howardjohn!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: howardjohn, robscott 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 |
this was unimplemented. Depends on kubernetes-sigs/gateway-api#1995 Tested by kubernetes-sigs/gateway-api#1989
* gateway mesh: support `port` field this was unimplemented. Depends on kubernetes-sigs/gateway-api#1995 Tested by kubernetes-sigs/gateway-api#1989 * Stable
What type of PR is this?
/kind bug
What this PR does / why we need it:
Currently, we cannot have:
This seems like an oversight; our validation only takes sectionName into consideration.
Note: this DOES allow overlapping parentSection selection. For exampe, i may select port=80 and sectionName=http which refer to the same thing. This is not something we can catch in validation. Perhaps we need to clarify the behavior here in the spec, if its not clear. Note this could always happen with 2 different routes anyways, though.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: