feat: support consistent hash for non-route backends#9231
Conversation
✅ 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: a7d8cef0a0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9231 +/- ##
==========================================
- Coverage 75.59% 75.56% -0.03%
==========================================
Files 252 252
Lines 41713 41722 +9
==========================================
- Hits 31531 31527 -4
- Misses 8057 8067 +10
- Partials 2125 2128 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR fixes ConsistentHash behavior for non-route service clusters (e.g., SecurityPolicy extAuth gRPC backends) by emitting cluster-level HTTP hash policies in the generated xDS, ensuring Envoy can consistently compute request hashes even when there is no per-route hash_policy.
Changes:
- Refactors route hash-policy construction into a shared helper and reuses it to set
HttpProtocolOptions.hash_policyfor non-route clusters. - Updates translator unit tests and golden xDS-IR outputs to reflect the new cluster-level
hashPolicyemission. - Updates e2e ext-auth manifests (scales ext-auth deployment to 2 replicas; configures backendSettings loadBalancer ConsistentHash) and adds a release note entry.
Reviewed changes
Copilot reviewed 7 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/testdata/ext-auth-service.yaml | Scales ext-auth Deployment to 2 replicas to enable validating consistent hashing scenarios. |
| test/e2e/testdata/ext-auth-grpc-securitypolicy.yaml | Configures extAuth gRPC backendSettings to use ConsistentHash (SourceIP). |
| release-notes/current.yaml | Adds bug-fix release note for ConsistentHash on non-route clusters via cluster-level hash policies. |
| internal/xds/translator/route.go | Extracts consistent-hash policy building into a reusable helper. |
| internal/xds/translator/cluster.go | Emits cluster-level HttpProtocolOptions.hash_policy for non-route clusters with ConsistentHash configured. |
| internal/xds/translator/cluster_test.go | Adds unit tests asserting cluster-level hash policy emission (and non-emission for route clusters). |
| internal/xds/translator/testdata/in/xds-ir/ext-auth-retry.yaml | Updates IR input testdata to include extAuth traffic consistentHash. |
| internal/xds/translator/testdata/out/xds-ir/ext-auth-retry.clusters.yaml | Updates expected cluster output: MAGLEV LB + cluster-level hashPolicy. |
| internal/xds/translator/testdata/out/xds-ir/oidc-provider-traffic-features.clusters.yaml | Updates expected output to include cluster-level hashPolicy where applicable. |
| internal/xds/translator/testdata/out/xds-ir/oidc-backend-cluster-provider.clusters.yaml | Updates expected output to include cluster-level hashPolicy where applicable. |
| internal/xds/translator/testdata/out/xds-ir/jwt-with-backend-tls-retry.clusters.yaml | Updates expected output to include cluster-level hashPolicy where applicable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # release-notes/current.yaml
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
|
/retest |
|
/retest |
What type of PR is this?
What this PR does / why we need it:
This PR adds consistent hash support for non-route backends.
Which issue(s) this PR fixes:
Fixes #7235
Release Notes: Yes