fix: By default, httproutes are sorted alphabetically based on names#6433
fix: By default, httproutes are sorted alphabetically based on names#6433fayizk1 wants to merge 5 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Fayiz Musthafa <fayizk1@gmail.com>
internal/gatewayapi/testdata/httproute-default-order-by-route-name.in.yaml
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6433 +/- ##
==========================================
- Coverage 70.93% 70.91% -0.02%
==========================================
Files 220 220
Lines 37259 37265 +6
==========================================
- Hits 26429 26426 -3
- Misses 9287 9292 +5
- Partials 1543 1547 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Fayiz Musthafa <fayizk1@gmail.com>
|
by doing this we are losing creationTimestamp order, because that is how the HTTPRoutes are originally processed the pro is this adds consistent ordering even when timestamp is same the con is
wdyt @envoyproxy/gateway-maintainers |
@arkodg |
@fayizk1 to do this, we'd also have to save creationTimestamp in the IR, which would increase mem, today the sort happens before translation gateway/internal/gatewayapi/route.go Line 58 in c455a6e |
|
hey @fayizk1 rethinking this one, this can be solved in gateway/internal/gatewayapi/route.go Line 60 in c455a6e |
Exactly, this is what I wanted to test, and I had a working version for sometime but did not get time to add a broader test case. We may also need to move to a stable sort in other sort logic to avoid order change when equal case. I will open another PR as soon as possible. (Just realized that I put wrong long in previous comment :) ) |
|
closing in favor of #6550 |
What type of PR is this?
fix: By default, httproutes are sorted alphabetically based on names
What this PR does / why we need it:
This PR ensures consistent route ordering by including route names in the default sorting logic, preventing the inconsistent reordering that may be triggered by unrelated updates (i.e. pod churn, etc.). After all sorting conditions, ties exist across multiple routes, causing this.
Requirements for the GW-API under these circumstances:
So sort routes by route names, which is a combination of namespace, route name, route index and domain.
Which issue(s) this PR fixes:
Fixes #6140
Release Notes: No