Skip to content

feat: support consistent hash for non-route backends#9231

Merged
zhaohuabing merged 4 commits into
envoyproxy:mainfrom
zhaohuabing:cluster-lb
Jul 22, 2026
Merged

feat: support consistent hash for non-route backends#9231
zhaohuabing merged 4 commits into
envoyproxy:mainfrom
zhaohuabing:cluster-lb

Conversation

@zhaohuabing

Copy link
Copy Markdown
Member

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

@zhaohuabing
zhaohuabing requested a review from a team as a code owner June 16, 2026 04:40
@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 4881828
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a5f1c2b2c10b50008110c8b
😎 Deploy Preview https://deploy-preview-9231--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@zhaohuabing zhaohuabing added this to the v1.9.0-rc.1 Release milestone Jun 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/xds/translator/cluster.go
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.56%. Comparing base (2874485) to head (4881828).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhaohuabing

This comment was marked as outdated.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing

Copy link
Copy Markdown
Member Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_policy for non-route clusters.
  • Updates translator unit tests and golden xDS-IR outputs to reflect the new cluster-level hashPolicy emission.
  • 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.

Comment thread test/e2e/testdata/ext-auth-grpc-securitypolicy.yaml
Comment thread internal/xds/translator/cluster_test.go
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 279688da11

ℹ️ 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".

# Conflicts:
#	release-notes/current.yaml
@zhaohuabing
zhaohuabing requested review from arkodg and zirain June 27, 2026 10:26
arkodg
arkodg previously approved these changes Jul 20, 2026

@arkodg arkodg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks !

@arkodg
arkodg requested review from a team July 20, 2026 03:48
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zirain

zirain commented Jul 21, 2026

Copy link
Copy Markdown
Member

/retest

@zirain

zirain commented Jul 21, 2026

Copy link
Copy Markdown
Member

/retest

@zhaohuabing
zhaohuabing merged commit 198d48a into envoyproxy:main Jul 22, 2026
130 of 143 checks passed
@zhaohuabing
zhaohuabing deleted the cluster-lb branch July 22, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConsistentHash under backendSettings in SecurityPolicy is not working for extAuth gRPC service

4 participants