Fix input order dependency in GW rules precedence#4792
Conversation
|
Hi @cezarsa. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cezarsa The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
c7f5617 to
61ef2a8
Compare
|
I was wrong in my initial analysis about non-determinism. The result is deterministic based on the route creation timestamp tie-breaker. That said, I still think the behavior here is wrong, since the rules have different hostname matches configured and shouldn't rely on the tie-breaker. |
6cd961f to
47648bb
Compare
|
Hi, |
Description
Currently, the rule precedence is non-deterministic when some rules include no hostname matches. This is demonstrated by the added test cases.
With no code changes, the test results are as follows:
input order independent result for mixed hostname and no-hostname rules - input order Ainput order independent result for mixed hostname and no-hostname rules - input order Binput order independent result for mixed hostname and no-hostname rules, with method - input order Ainput order independent result for mixed hostname and no-hostname rules, with method - input order BThe only thing that changes between test cases with
input order Aandinput order Bis really the order of the input rules.In practice, this makes the rule ordering non-deterministic, since the input order depends on Go map ordering and the order in which resources are read from the k8s cluster. This bug was found in production while investigating why the listener rules order was flapping.
The fix included here is tentative, and I'm not sure if that's the right approach. I'm open to suggestions on different fixes that make the output deterministic.
Checklist
README.md, or thedocsdirectory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯