-
Notifications
You must be signed in to change notification settings - Fork 681
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
handle Route conflicts with HTTPRoute.Matches #6188
Merged
skriss
merged 15 commits into
projectcontour:main
from
lubronzhan:topic/lubron/fix-3608
Apr 17, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b52642d
Add tests for routes, add two map to help find duplicate route
lubronzhan a63c56f
Update logic to use header+queryParam as key for map to filter confl…
lubronzhan 5c3aeaf
Update logic to treat each route object as a single match object to c…
lubronzhan 349ddb5
Release note
lubronzhan 41fe957
Final refactor on logic and some unite tests
lubronzhan 73b30c0
Fix conflict between upstremam
lubronzhan 61d7a59
More unit test
lubronzhan 49ac07c
E2E test
lubronzhan 62fb194
Basic comment resolvement
lubronzhan 8bfad9d
Update the partially match condition
lubronzhan bdc2ed8
Refactor
lubronzhan a6b1f5e
Update the test
lubronzhan 2251062
Update check command
lubronzhan c6187e2
Use different route
lubronzhan 2ae98cc
Resolve comments
lubronzhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Gateway API: handle Route conflicts with HTTPRoute.Matches | ||
|
||
It's possible that multiple HTTPRoutes will define the same Match conditions. In this case the following logic is applied to resolve the conflict: | ||
|
||
- The oldest Route based on creation timestamp. For example, a Route with a creation timestamp of “2020-09-08 01:02:03” is given precedence over a Route with a creation timestamp of “2020-09-08 01:02:04”. | ||
- The Route appearing first in alphabetical order (namespace/name) for example, foo/bar is given precedence over foo/baz. | ||
|
||
With above ordering, any HTTPRoute that ranks lower, will be marked with below conditions accordionly | ||
1. If only partial rules under this HTTPRoute are conflicted, it's marked with `Accepted: True` and `PartiallyInvalid: true` Conditions and Reason: `RuleMatchPartiallyConflict`. | ||
2. If all the rules under this HTTPRoute are conflicted, it's marked with `Accepted: False` Condition and Reason `RuleMatchConflict`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One case I'm not totally clear on is: what if a rule in a given HTTPRoute has multiple matches defined, and only one of those matches conflicts with another HTTPRoute? Should the entire rule be dropped, or only the match that conflicted? (matches within a rule are logically OR'ed)
https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.RouteConditionType docs for PartiallyInvalid seem to imply that the entire rule should be dropped, but it's not crystal clear from the spec. I think this PR's implementation is good for now (dropping the entire rule), but this is an example of something that could be clarified and encoded in the upstream conformance test.
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.
Sunjay also mentioned here, in upstream, it does indicate that we should drop at the rule level, if one rule is conflict, just drop it and leave other rules