feat: add support for external sds cluster #10738
<span aria-hidden="true">✅</span> Deploy Preview for cerulean-figolla-1f9435 ready!
Built without sensitive environment variables
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 02e24bd5931deb991dee9677d99d2724054d1c06 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6b0e9ec8b82702d0a1a28d14 |
|<span aria-hidden="true">😎</span> Deploy Preview | https://deploy-preview-10738--cerulean-figolla-1f9435.netlify.app |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />!QR Code<br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- cerulean-figolla-1f9435 Preview -->
_To edit notification comments on pull requests, go to your Netlify project configuration._
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"02e24bd5931deb991dee9677d99d2724054d1c06","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
<details>
<summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-12-01T10:23:28.228967Z">2026-12-01T10:23:28.228967Z</relative-time> | 02e24bd | New commits |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
</details>
</details>
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd09e571aa
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
<sub><sub>!P2 Badge</sub></sub> Reject userinfo instead of dropping it from cluster names
When an SDS Secret uses an @ in the authority (for example sds://tenant@external-sds), net/url stores the prefix in u.User, but this returns only u.Host; the Secret therefore passes validation and silently targets external-sds, either making an Envoy cluster named tenant@external-sds unaddressable or discarding credentials the user may believe were configured. Reject u.User != nil so malformed references fail instead of resolving secrets through a different cluster.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
Codecov Report
:x: Patch coverage is
97.31544% with 4 lines in your changes missing coverage. Please review.:white_check_mark: Project coverage is 82.85%. Comparing base (
a50bb96) to head (02e24bd).:warning: Report is 2 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| internal/ir/xds.go | 77.77% | 2 Missing :warning: |
| internal/xds/translator/sds.go | 98.44% | 2 Missing :warning: |
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #10738 +/- ##
==========================================
+ Coverage 82.84% 82.85% +0.01%
==========================================
Files 279 279
Lines 44687 44781 +94
==========================================
+ Hits 37019 37103 +84
- Misses 7667 7677 +10
Partials 1 1
</details>
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
<sub><sub>!P1 Badge</sub></sub> Verify the TLS server name from the SDS URL
When TLS is enabled for an sds:// DNS endpoint, buildSDSUpstreamTLSSocket receives only the file settings, so the resulting context sets neither UpstreamTlsContext.sni nor SAN/auto-SAN validation from the URL host. Consequently, a virtual-hosted server may present the wrong default certificate and any otherwise-valid certificate signed by the configured CA is accepted regardless of hostname; pass the SDS host into this builder and use it for SNI and server-name verification.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Reject conflicting TLS settings for a shared SDS URL
When two SDS references share a URL but carry different tlsSettings (including one reference having connection credentials while another has none), collectSDS silently replaces the earlier config here. Because sdsClusterNameFromURL also keys the cluster only by URL, the single emitted cluster uses whichever client certificate/CA was visited last, causing the other reference to authenticate with the wrong identity or fail; compare and reject conflicting configs or include the connection settings in the cluster identity.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Require cert and key to share the watched directory
When certificatePath and privateKeyPath are mounted in different directories, this TlsCertificate watches only the certificate's directory. A projected-volume rotation in the key directory therefore does not trigger a reload (and a cert-first two-directory rotation can leave the new pair unloaded), despite both paths being independently configurable; validate that both files share the watched directory or arrange a common watched parent.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3c2d0917e
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
I think it is common case to have both in same folder.
<sub><sub>!P1 Badge</sub></sub> Require server authentication for SDS TLS
When a Secret contains tlsSettings but omits caCertificatePath (for example {} or only a client certificate/key), NewSDSConfig still enables TLS, but this guard leaves the UpstreamTlsContext without any validation context. Envoy then accepts an unauthenticated SDS peer, so an on-path server can supply arbitrary certificate, key, or CA material; require a CA for TLS or make insecure operation an explicit opt-in.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Use hostname-aware validation for the derived SDS SAN
When the SDS URL hostname is covered by a normal wildcard certificate such as *.example.com, the derived value here is the concrete host external-sds.example.com, and an exact matcher compares it to the literal wildcard SAN and rejects the connection. Use Envoy's hostname-aware SNI/SAN validation for the derived default so wildcard DNS certificates retain standard TLS hostname semantics.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Reject SDS ports outside the TCP range
For URLs such as sds://external-sds.example.com:65536 or port 0, net/url still returns a non-empty numeric port, so the Secret passes Gateway validation; buildSDSCluster later only parses it as a uint32, yielding an invalid or unreachable SDS endpoint and leaving the referenced certificates unavailable. Parse and require a port in the range 1–65535 here.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b26837501
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
Shouldn't this also use tlsCertificateSdsSecretConfigs's pathConfigSource for auto rotation?
Can we do conflict detection in the gateway api layer, so the error surfaces in the relevant BackendTLSPolicy status instead of blocking XDS?
Seems valid
Added some questions, thanks!
Yes. Will change
why we need a new type here? could we reuse the TODO http, https case?
we can but I chose to use new type to force tls/non-tls based on TLS settings supplied in the secret. But if you think we should switch to http/https - we can but needs validation that https needs TLSSettings
There is not easy way today to do it across BackendTLSPolicy, Listeners etc. That is why added it here. Not sure if there is any better approach here. Probably reusing the first secret on conflict may be simpler here without throwing error.
<sub><sub>!P1 Badge</sub></sub> Read the configured PEM files as TLS material
When tlsSettings uses the documented .crt/.key paths, pathConfigSource interprets caCertificatePath and certificatePath as serialized SDS DiscoveryResponse files rather than PEM files. The output therefore asks Envoy to parse ca.crt/tls.crt as xDS resources, while privateKeyPath is never referenced at all, so server-auth TLS and mTLS to an external SDS server cannot load the configured credentials; build file-backed TLS certificate/validation data from all three paths, or redefine the API and examples around SDS descriptor files.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Set the external endpoint as the gRPC authority
When an external SDS server validates or routes the HTTP/2 :authority, sdsSecretConfig leaves EnvoyGrpc.Authority empty, so Envoy falls back to this generated cluster name. For an sds://external-sds.example.com:8234 endpoint that value is sds_external-sds.example.com:8234_<hash>, not the endpoint authority, and can be rejected or routed to the wrong virtual host; carry sds.Address into the Envoy gRPC authority for network SDS connections.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<sub><sub>!P2 Badge</sub></sub> Treat equivalent SAN lists as the same settings
When two SDS Secrets share a URL and contain the same subjectAltNames in different orders, this returns false even though Envoy treats the SAN matchers as an unordered OR list. processSDSClusters then rejects the gateway as having conflicting settings instead of emitting the valid shared cluster; compare normalized SAN sets before declaring a conflict.
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02e24bd593
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
Some how missed this. Let me fix it
ramaraochavali
Added support configuring external SDS server for listeners and backends.
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/.