Skip to content

fix(translator): use a cluster per setting for shared endpoints with different TLS - #10466

Open
yuminn-k wants to merge 3 commits into
envoyproxy:mainfrom
yuminn-k:shared-endpoint-tls-cluster-per-setting
Open

yuminn-k wants to merge 3 commits into
envoyproxy:mainfrom
yuminn-k:shared-endpoint-tls-cluster-per-setting

Conversation

@yuminn-k

@yuminn-k yuminn-k commented Oct 31, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

When two backendRefs in one route rule point to the same IP (or UDS) endpoint but carry different TLS settings, for example two Backends with different clientCertificateRef during an mTLS client certificate rotation, the xDS translator put them in one EDS cluster as two localities, each with its own transport_socket_matches entry. EDS merges hosts with the same address, so Envoy kept only the first endpoint: the second TLS setting was never used and the traffic split between the backendRefs was lost, with no error or warning.

This PR adds RouteDestination.HasSharedEndpointsWithDifferentTLS and adds it to NeedsClusterPerSetting, as suggested in the issue. Such rules now get a cluster per setting, and traffic is split with weighted_clusters. The check:

  • skips FQDN settings, because STRICT_DNS clusters don't merge hosts (the /fqdn rule in the fixture keeps its single cluster),
  • keys endpoints by host:port, or by path for UDS,
  • compares the settings' TLSUpstreamConfig with reflect.DeepEqual, so settings without TLS and settings with TLS on the same endpoint also count as different.

Rules whose backendRefs share an endpoint with identical TLS settings keep the current single cluster. Giving every shared IP endpoint a cluster per setting, regardless of TLS, is the more conservative alternative described in the issue. I left it out to keep this change small.

This builds on the fixture from #10460. Its commit is cherry-picked unchanged as the first commit, so this PR can be rebased cleanly once #10460 merges. The second commit regenerates the xDS golden output for backend-mtls-rotation (rule/0 now produces rule/0/backend/0 and rule/0/backend/1 clusters plus a weighted_clusters route action) and replaces the fixture's "Known issue" comments with a description of the fixed behavior. The gatewayapi golden output is unchanged, because the split happens in the xDS translator.

Tests:

  • go test ./internal/ir/... ./internal/gatewayapi/... ./internal/xds/... ./internal/cmd/egctl/... pass
  • New cases in TestRouteDestination_NeedsClusterPerSetting: a shared IP with different TLS, a shared IP with TLS and without TLS, a shared IP with the same TLS, different IPs, and a shared FQDN
  • Golden files regenerated with go test ./internal/xds/translator ./internal/gatewayapi --override-testdata=true
  • golangci-lint run / fmt --diff on ./internal/ir/... are clean

Release note: release-notes/current/bug_fixes/10461-shared-endpoint-tls-cluster-per-setting.md. It is named after the issue number. I can rename it to the PR number if preferred.

AI assistance: this change was prepared with Claude Opus 5.5 (Claude Code).

Which issue(s) this PR fixes:
Fixes #10461


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: bug fix with 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/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.

🤖 Generated with Claude Code

https://claude.ai/code/session_012bPQTxDmyCAwQaT3PtwxBr

zirain and others added 2 commits October 31, 2026 12:20
…different TLS

When two backendRefs in a route rule point to the same IP or UDS endpoint
with different TLS settings, they became localities of one EDS cluster.
EDS merges hosts with the same address, so Envoy kept only the first
endpoint and its transport socket match, and the other TLS settings
(e.g. a rotated client certificate) were never used.

Add RouteDestination.HasSharedEndpointsWithDifferentTLS and include it in
NeedsClusterPerSetting, so such rules get a cluster per setting and are
split with weighted clusters.

Assisted-by: Claude Opus 5.5
Signed-off-by: YuMin Kim <yuminkim.dev@gmail.com>
@yuminn-k
yuminn-k requested a review from a team as a code owner October 31, 2026 03:27
Signed-off-by: YuMin Kim <yuminkim.dev@gmail.com>
Assisted-by: Claude Opus 5.5
@netlify

netlify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T03:28:35.399827Z
We couldn’t complete this review. Comment @codex review to try again.
532fbb2 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

IP Backends with the same endpoint but different TLS settings in one rule lose all but the first TLS config

2 participants