Skip to content

fix(translator): decide merge eligibility from what a cluster actually uses - #10804

Draft
zhaohuabing wants to merge 3 commits into
envoyproxy:mainfrom
zhaohuabing:btp-cluster-settings-for-protocol
Draft

zhaohuabing wants to merge 3 commits into
envoyproxy:mainfrom
zhaohuabing:btp-cluster-settings-for-protocol

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:

This takes a different approach from #10421. Instead of adding a per-route-kind exception to the merge check, it moves the "which BackendTrafficPolicy fields reach which kind of cluster" decision into one function, ClusterTrafficFeatures.ForProtocol. A route now only leaves the shared cluster when its policy changes something that cluster would actually use.

The function replaces three separate field lists:

  • the merge check, which now builds the policy's cluster settings, trims them for the route's protocol, and demerges only if something is left
  • the per-protocol subsets in applyGatewayPolicyToMergedCluster
  • the TCP and UDP loops for route-level and Gateway/listener-level policies

Gateway, listener and ListenerSet targets are judged as HTTP, which keeps every field, so they behave as before. A policy whose settings fail to build still demerges.

Follow-ups: the UnsupportedField warning still only covers http1 and could report whatever ForProtocol drops; non-merged GRPCRoutes still copy http1 into their own cluster.

Which issue(s) this PR fixes:

Fixes #10307


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: N/A: no API changes.
  • Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: N/A: no user-facing configuration change.
  • Release notes: For any non-trivial change, added a release-note fragment under release-notes/current/<section>/<pr-number>-<slug>.md (see release-notes/current/README.md for sections and naming). N/A if this PR does not contain non-trivial changes.
  • Generated files committed: N/A: no API, helm or module changes.
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments.

@netlify

netlify Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cerulean-figolla-1f9435 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4b800e2
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6b125ffe1ca3666ae5c8c22c
😎 Deploy Preview https://deploy-preview-10804--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.

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.72131% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.85%. Comparing base (0b677fb) to head (4b800e2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/gatewayapi/backendtrafficpolicy.go 97.29% 1 Missing ⚠️
internal/ir/xds.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10804   +/-   ##
=======================================
  Coverage   82.85%   82.85%           
=======================================
  Files         278      278           
  Lines       44695    44695           
=======================================
+ Hits        37032    37033    +1     
+ Misses       7662     7661    -1     
  Partials        1        1           

☔ 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.

…y uses

The merge check, merged clusters and the TCP/UDP route loops each kept their own list of which BackendTrafficPolicy fields reach which kind of cluster. They now share one function on the IR cluster settings, so a route only leaves the shared cluster when its policy changes something that cluster would use. This stops http1 on a GRPCRoute from splitting off the route, and gives Gateway-level policies the backend connection settings that route-level ones already applied to TCP routes.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io>
@zhaohuabing
zhaohuabing force-pushed the btp-cluster-settings-for-protocol branch from c6549e6 to fc0e07f Compare December 4, 2026 06:38
The TCP backend connection fix landed separately in envoyproxy#10805, so this release note only needs the merge change.

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

This branch has not been deployed

No deployments
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.

MergeBackends: hasClusterSettings may consider the xRoute type to allow further de-duping

1 participant