fix(translator): attach extension server policies to the target Gateway's listeners only - #10099
vvoytovych wants to merge 2 commits into
Conversation
…ay's listeners only With mergeGateways, the xDS IR of a GatewayClass holds the listeners of all its Gateways. translateExtServerPolicyForGateway walked that IR, so an extension server policy that targets one Gateway was referenced from the listeners of every Gateway in the class, and a policy with a sectionName from every listener of that name. Take the listeners from the targeted Gateway and look up each IR listener by name, as the route-targeted path already does. The sectionName is now matched only against that Gateway's listeners. Behaviour without mergeGateways is unchanged. Add a unit test and a golden test with two merged Gateways that share listener names. TestTranslateWithExtensionKinds now ignores redacted private keys, as TestTranslate does, so that its golden files can hold an HTTPS listener. Signed-off-by: Viktor Voytovych <vvoytovych@gmail.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@codex review |
|
@zirain, could you approve the workflow run for this PR? This is my first PR here, so its four workflows are waiting for approval. I would like this fix in the October patch, v1.9.3. We are upgrading to v1.9.2, and we run I tried the pick. On |
|
Thanks @vvoytovych, I have approved the workflows |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10099 +/- ##
==========================================
+ Coverage 81.41% 81.44% +0.02%
==========================================
Files 266 266
Lines 41300 41296 -4
==========================================
+ Hits 33626 33634 +8
+ Misses 7673 7661 -12
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/retest |
|
Thanks @cnvergence for approving the workflows. One e2e job failed on @guydc @zirain, could one of you review this? #3371 added this code, and #10071 changed it on 09-24. |
|
/retest |
|
To align with other policies, we may want to reject xPolicy to target to a Gateway when mergeGateways is enabled. |
|
@zirain, the reason in #10062 is right, and we will change our side. What we agree with
What we will do
What we ask
Why we need the time
Other points
Let me know if you have concerns. Thanks. |
What this PR does / why we need it:
With
mergeGateways: true, an extension server policy that targets one Gateway is attached to the listeners of every Gateway in the GatewayClass.translateExtServerPolicyForGatewayloops over every listener in the IR of the Gateway's IR key. WithmergeGateways, that key is the GatewayClass, so the loop covers every Gateway. ThesectionNamecheck compares only the last segment of the IR listener name, so it also matches other Gateways' listeners of the same name.This change takes the listeners from the targeted Gateway, finds each one's IR listener by name, and matches
sectionNameagainst that Gateway's own listener names. WithoutmergeGateways, the result is the same as before.What changes for users with
mergeGateways:sectionNamenames.HTTPListenerpost-hook no longer receives other Gateways' policies.sectionNamenames a listener that only another Gateway has is no longer reportedAccepted.main, after perf: store extension server resources centrally #10071, that saves about 5 MiB. Before perf: store extension server resources centrally #10071, each attachment is a full copy of the policy; there, on v1.7.4, the same fix took the controller from 912 MiB to 71 MiB at rest.The two lines in
translator_test.gomakeTestTranslateWithExtensionKindsignoreir.PrivateBytes, asTestTranslatealready does. Without them, an extension golden file cannot hold an HTTPS listener, because the key is written as[redacted].The bug has been present since v1.1.0 (#3371). Please consider a cherry-pick into release-v1.9 and release-v1.8.
Which issue(s) this PR fixes:
Fixes #10097
PR Checklist
git commit -s). See DCO: Sign your work./api.make generate gen-check,make lint, andgo test ./internal/...pass locally.TestTranslateExtServerPolicyForGateway) and a golden test (extensionpolicy-merged-gateways). Both fail without the fix. The added lines are fully covered.release-notes/current/bug_fixes/10097-extension-server-policy-merged-gateways.md.make gen-checkleaves no diff.