Skip to content

feat(gatewayapi): support SDS listener certificate references - #9525

Open
Sharvash wants to merge 9 commits into
envoyproxy:mainfrom
Sharvash:issue-8915-sds-listener-certificate-refs
Open

feat(gatewayapi): support SDS listener certificate references#9525
Sharvash wants to merge 9 commits into
envoyproxy:mainfrom
Sharvash:issue-8915-sds-listener-certificate-refs

Conversation

@Sharvash

@Sharvash Sharvash commented Jul 19, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

Allow Gateway listeners to use gateway.envoyproxy.io/sds Secrets in tls.certificateRefs when enableSDSSecretRef is enabled.

This change:

  • validates SDS certificate references and preserves ReferenceGrant checks
  • passes SDS configuration through the IR
  • creates static UDS clusters for downstream certificate delivery
  • prevents cluster name collisions by adding a hash to Unix socket cluster names
  • reports when certificate DNS names cannot be inspected
  • applies the ALPN safety behavior only when multiple valid HTTPS listeners share a port: SDS-backed listeners are downgraded, while inline-certificate peers are affected only when their known DNS SANs overlap the SDS listener hostname (or when that hostname is unspecified)
  • keeps HTTP/2 enabled for a standalone SDS-backed HTTPS listener
  • adds documentation, release notes, translator fixtures, and Kubernetes E2E coverage

The Unix socket cluster naming change affects existing generated xDS. EnvoyPatchPolicies and extension servers that refer to the previous cluster names must be updated. This is documented in the breaking-change release note.

Which issue(s) this PR fixes:

Fixes #8915

Local validation:

  • make generate
  • make gen-check
  • make lint
  • make build
  • go test ./internal/gatewayapi/... ./internal/ir/... ./internal/xds/translator/... -count=1

The live Kubernetes E2E scenario was not run locally.


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).
  • API agreed first: N/A - this PR does not change files under /api.
  • Required checks pass: Generation, generated-file checks, lint, build, and affected Go tests pass locally.
  • Tests added/updated: Added gateway API, IR, xDS translator, SDS server, and E2E coverage.
  • Docs: Added SDS listener configuration and security guidance.
  • Release notes: Added new-feature and breaking-change fragments.
  • Generated files committed: make gen-check passes.
  • Scope & compatibility: The xDS cluster naming change is documented as breaking.
  • Codex review: Not requested on GitHub yet.
  • Copilot review: Not requested on GitHub yet.

@Sharvash
Sharvash requested a review from a team as a code owner July 19, 2026 10:52
@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

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

@Sharvash
Sharvash force-pushed the issue-8915-sds-listener-certificate-refs branch from 6b20f25 to f8a6e4d Compare July 19, 2026 11:11
@arkodg
arkodg requested review from guydc, zhaohuabing and zirain July 20, 2026 01:33
@arkodg arkodg added this to the v1.9.0-rc.1 Release milestone Jul 20, 2026
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.27%. Comparing base (6c9bb06) to head (b6171ac).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9525      +/-   ##
==========================================
+ Coverage   76.06%   76.27%   +0.21%     
==========================================
  Files         260      261       +1     
  Lines       43449    43631     +182     
==========================================
+ Hits        33048    33279     +231     
+ Misses       8196     8155      -41     
+ Partials     2205     2197       -8     

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

@zirain

zirain commented Jul 21, 2026

Copy link
Copy Markdown
Member

@arkodg , I would like to merge #9030 first if possible.

@Sharvash
Sharvash force-pushed the issue-8915-sds-listener-certificate-refs branch from f8a6e4d to 9a20e02 Compare July 29, 2026 10:12
@zhaohuabing

Copy link
Copy Markdown
Member

Hi @Sharvash could you please fix the conflicts?

Allow SDS-backed certificates in listener IR validation when both the
Unix socket URL and secret name are set. Keep inline certificate
validation unchanged and cover invalid SDS configurations.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
Accept Secrets with the gateway.envoyproxy.io/sds type when
enableSDSSecretRef is enabled. Preserve ReferenceGrant checks,
partial-invalid listener status, and certificate reference ordering
while continuing to normalize inline TLS Secrets.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
Translate listener SDS references into canonical static UDS clusters
and wire them into Envoy TLS certificate SDS configs. Deduplicate
clusters by socket URL and reject name collisions without exposing raw
socket paths in errors.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
Document the SDS Secret format, feature-gate behavior,
cross-namespace references, and certificate-overlap limitation.
Add the release note for issue envoyproxy#8915.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
Add a UDS-backed SDS test server and an HTTPS Gateway scenario that verifies backend traffic and the exact certificate served by Envoy. Enable SDS Secret references in each E2E profile.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
@Sharvash
Sharvash force-pushed the issue-8915-sds-listener-certificate-refs branch from 9a20e02 to ecd9b22 Compare August 3, 2026 14:43
@Sharvash

Sharvash commented Aug 3, 2026

Copy link
Copy Markdown
Author

Hi @zhaohuabing, done

Comment thread internal/ir/sds.go Outdated
@zhaohuabing

Copy link
Copy Markdown
Member

/retest

Comment thread internal/gatewayapi/listener.go Outdated
Comment thread internal/gatewayapi/listener.go Outdated
SDS cluster names are an xDS translation detail and have no IR
consumers. Keep the helper private to the translator and colocate its
collision and UTF-8 tests without changing generated names.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
SDS listener references are validated before IR construction, and invalid
references already surface as InvalidCertificateRef.

Rely on that boundary to remove duplicate conversion error propagation
and listener condition handling.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
@Sharvash
Sharvash requested a review from zhaohuabing August 4, 2026 14:19
@zhaohuabing
zhaohuabing requested a review from a team August 5, 2026 03:50
Comment thread internal/gatewayapi/listener.go Outdated
Report opaque SDS certificate names through the Gateway API standard
OverlappingTLSConfig condition while retaining the SDSCertificateOpaque
reason. Remove the obsolete custom condition type and update status tests.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
@Sharvash
Sharvash requested a review from zhaohuabing August 5, 2026 08:32

@zhaohuabing zhaohuabing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@zhaohuabing

Copy link
Copy Markdown
Member

/retest

@zirain

zirain commented Aug 6, 2026

Copy link
Copy Markdown
Member

/retest

@zirain

zirain commented Aug 6, 2026

Copy link
Copy Markdown
Member

@codex review

@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: b6171ac179

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +574 to +575
for _, dnsName := range listener.tls.certDNSNames {
if areOverlappingHostnames(sdsListener.Hostname, new(gwapiv1.Hostname(dnsName))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Treat every same-port SDS peer as overlapping

When the SDS listener has an explicit hostname, this loop only downgrades non-SDS peers whose known SAN overlaps that hostname. However the SDS certificate's SANs are the opaque part, and EG does not require the served cert to contain only the listener hostname; an SDS server for sds.example.com can return a cert that also covers foo.example.com. In that configuration a client can open an h2 connection to the SDS listener and coalesce foo.example.com requests onto it, while the foo.example.com listener remains on h2 because its SANs do not match sds.example.com. Any same-port peer of a valid SDS-backed HTTPS listener should be treated as overlapping unless ALPN is explicitly configured.

Useful? React with 👍 / 👎.

@zhaohuabing
zhaohuabing self-requested a review August 6, 2026 04:56
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.

Allow gateway.envoyproxy.io/sds secrets in listener tls.certificateRefs

4 participants