-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
policy: limit TCPRoute to one per policy response #13272
Merged
Merged
Changes from all commits
Commits
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
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.
Are the routes sorted in any particular way at this point when we take the first one? Is there a deterministic way to know which TCP route will take affect and which ones will be ignored?
If there are multiple TCP routes attached, should we be setting a RouteConflict and/or Accepted=false status on them?
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.
I'd have to consult more of the impl to tell you how/where this is happening, but the routes must be sorted according to preference (i.e. according to the route sorting rules dictated by the gateway API--naming, creation timestamp, etc). This change, as it is, simply encodes what the proxy would already do: use the first matching route. The proxy has no concept of conflicts or accepted=false, so all of that ordering must be handled in the policy controller.
Given that this function is building the actual protobuf types, I believe that must have already happened.
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.
The sorting happens before this is called:
linkerd2/policy-controller/grpc/src/outbound.rs
Lines 436 to 437 in 8fb22d6
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.
@adleong @olix0r
As pointed out sorting happens before this is called. In general the GW api spec does not prescribe setting conflict statuses in these cases. These are prescribed when there are routes with higher specificity (ie GRPC > HTTP). In cases when there are more than one route we need to follow disambiguation rules. In cases like HTTPRoute that would be more specific hostname, header and method matches. In the case of TCP these things are not present so we revert to sorting on route age and naming. For reference: