Repository navigation
api: backend priority filter - #10027
Conversation
Signed-off-by: kkk777-7 <[email protected]>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba70f686f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10027 +/- ##
=======================================
Coverage 81.42% 81.43%
=======================================
Files 266 266
Lines 41300 41300
=======================================
+ Hits 33630 33633 +3
+ Misses 7669 7666 -3
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/retest |
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
|
/retest |
…3094) **Description** `AIGatewayRouteRuleBackendRef.priority` was invisible to Envoy Gateway: the extension server rewrote LocalityLbEndpoints.priority in `PostTranslateModify`, and the controller stamped `gateway.envoyproxy.io/backend-ref-priority` annotation on every generated HTTPRoute to force re-translation. EG copies that annotation into the metadata of every route and cluster, which inflates xDS, and EG could not see the priority, so MergeBackends split prioritized rules into separate clusters and broke failover. This uses the backendPriority HTTPRouteFilter added in EG v1.10 instead: - For each backendRef with a non-zero priority, reference a shared per-namespace HTTPRouteFilter (ai-eg-backend-priority-<n>). Priority 0 gets no filter, which keeps rules without priorities eligible for MergeBackends. - The filters are labeled managed-by and are not owned by any AIGatewayRoute. A filter is deleted once no AIGatewayRoute in the namespace uses its priority, which is looked up through a new AIGatewayRoute field index. A filter that is deleted out of band is recreated on the next reconcile. **Related Issues/PRs (if applicable)** Fixes #2915 Related PR: envoyproxy/gateway#10027 (backendPriority API), envoyproxy/gateway#10248 (implementation) **Special notes for reviewers (if applicable)** Migration: - The extension server rewrite is kept for one release (to be removed in v1.5) so that HTTPRoutes generated by the previous version keep their priorities until they are reconciled. It logs when it changes the priority EG set, so it can be confirmed unused before removal. - A non-zero priority overrides the Backend's spec.fallback. Priority 0 no longer does, so fallback: true on a Backend now takes effect. **E2E on Envoy Gateway v1.9.3 skips `TestTrafficSplittingFallback` and `Test_Examples_StreamIdleTimeout`.** Both rely on backendRef priority failover. The CI matrix still runs e2e on EG v1.9.3, which has no `backendPriority`: the CRD prunes the field, and any backendRef filter makes EG build one cluster per backendRef of the rule, so the backendRefs end up behind `weighted_clusters` and do not fail over. v1.9 is below the minimum EG version (v1.10.0) in the compatibility matrix, so these tests are skipped there via `e2elib.EnvoyGatewaySupportsBackendPriority`, like the other version-gated e2e tests. Agent Router v1.2.x / v1.3.x keep the previous mechanism and are not affected. **Shared filters instead of per-route ones.** EG scans `resources.HTTPRouteFilters` linearly for each reference, so the filters are shared per namespace and priority (at most 128 per namespace) rather than created per AIGatewayRoute. As with the shared MCP proxy Backend (`ensureMCPProxyBackend`), they have no owner and are not watched. --------- Signed-off-by: kkk777-7 <[email protected]> Co-authored-by: Ignasi Barrera <[email protected]>
What this PR does / why we need it:
Adds
backendPriorityfield toHTTPRouteFilter. This PR only adds the API.It sets the Envoy locality priority (
LocalityLbEndpoints.priority) of the backendRef it is attached to, so a route rule can fail over across more than two tiers and each route can order the same backends differently.Today
Backend.spec.fallbackis the only way to set a priority. It is a bool, it lives on theBackendrather than on the backendRef, and it cannot be used with Service backendRefs.Backend. Priority describes how backendRefs relate within a rule, likeweight, not a property of the backend. A field onBackendwould require duplicateBackendobjects whenever one backend is primary on one route and a fallback on another, and it cannot cover Service backendRefs.Which issue(s) this PR fixes:
Fixes #
Related #10007
PR Checklist
git commit -s). See DCO: Sign your work./api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.)release-notes/current/<section>/<pr-number>-<slug>.md(seerelease-notes/current/README.mdfor sections and naming). N/A if this PR does not contain non-trivial changes.make gen-checkand committed the result if API/helm charts/modules changed.release-notes/current/breaking_changes/.