-
Notifications
You must be signed in to change notification settings - Fork 136
Add support for Port in ParentReference #3778
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
base: main
Are you sure you want to change the base?
Conversation
f0fc793
to
494f68a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3778 +/- ##
==========================================
+ Coverage 87.00% 87.11% +0.10%
==========================================
Files 128 128
Lines 16404 16442 +38
Branches 62 62
==========================================
+ Hits 14273 14324 +51
+ Misses 1956 1944 -12
+ Partials 175 174 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Nice work! You'll also need to update our compatibility doc in the docs repo (merge to branch ngf-release-2.2
) with these updates.
@sjberman I chose to refactor the attachToListener side, which was weird because we're actually sorting the listeners downstream. I'm not sure the original intention of sorting, but I removed it now. This shouldn't make any functionality changes (besides the port addition) |
Usually when we are sorting something, it's for good reason :) but I'll take a look. |
e964100
to
012cc3f
Compare
Are we only attaching a single listener based on the port? Meaning, if a port is specified, we attach to the matching port. But if the port is not specified, then the existing rules still apply — such as using the winning hostname or attaching to multiple listeners. I just want to confirm that listener isolation rules remain unchanged. |
If a port is specified, the rules should be the same, with the additional port filtering added |
I refactored the code and did fixed the bug from that issue. The reason why I refactored the code was because that the previous fix seemed to introduce bugs, so I had to do it differently, in policies |
@sarthyparty Could you explain a little more about the refactoring that will be introduced in this pr? Also, could you explain some more on what bugs the previous fix seemed to have introduced? Usually that is included in the PR description or just a comment on the PR, and will help us if we ever need to trace back to this PR. |
but what is preferred first? |
While adding the Port parentRef feature, I noticed that buildSectionRefs and findAttachableListeners had duplicated logic. I first tried to refactor findAttachableListeners, but that seemed to create much more complexities, so I decided to refactor buildSectionNameRefs and then solve the bug differently in policies. In policies I noticed a really small issue where we weren't looping through hostnames correctly so I fixed that and also added in the fix for the bug. |
The complexities that seemed difficult to address were sorting the L4Route attachable listeners, which didn't happen when the sectionName was nil, and also the parentRef attachment status logic was going to have issues since the parentsRefs were split. |
Wdym by this? My main code change was just filtering the attachable listeners by port if port was specified. I don't mess with any of the rules. |
Not the rules, but hostnames. So for example if we have two listeners with same hostnames/wildcards and 2 routes also having 2 hostnames with both those hostnames and port is also specified, we will select listeners based on port or hostname first? For example Gateway
2 HTTPRoutes
which listener would attach to which route? do we prioritize port match or hostname match? |
The first HTTPRoute would attach to no listeners because the sectionName does not match any listener names. The second HTTPRoute would not attach to any listener because the listener that matches the section name doesn't have the port matching. |
Assuming you meant to make the sectionName nil for the first HTTPRoute, then my changes would see that the port matches both listeners on the gateway and return them both as attachable listeners. What happens next based on the hostname, is unchanged. |
oh yeah my bad I wanted to remove the sectionaName. Thank you for the clarification |
96b1cc1
to
c4c78fe
Compare
c4c78fe
to
6ce774c
Compare
Proposed changes
Problem: ParentRefs didn't support Port
While adding this feature, I noticed that buildSectionRefs and findAttachableListeners had duplicated logic. I first tried to refactor findAttachableListeners, but that seemed to create much more complexities, so I decided to refactor buildSectionNameRefs and then solve the bug differently in policies. In policies I noticed a really small issue where we weren't looping through hostnames correctly so I fixed that and also added in the fix for the bug.
Solution: I added support for it and enabled conformance
Testing: Unit tests and conformance test
Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.
Closes #2946
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.