Skip to content

[Gateway source controllers]: Fix cross-listener SAN pollution when gateway has multiple HTTPS listeners#728

Merged
gardener-prow[bot] merged 3 commits into
masterfrom
fix/gateway-multiple-listeners
May 19, 2026
Merged

[Gateway source controllers]: Fix cross-listener SAN pollution when gateway has multiple HTTPS listeners#728
gardener-prow[bot] merged 3 commits into
masterfrom
fix/gateway-multiple-listeners

Conversation

@MartinWeindel
Copy link
Copy Markdown
Member

How to categorize this PR?

/kind bug

What this PR does / why we need it:
Two commits fixing cross-listener SAN pollution in gateway source controllers described in issue Gateway API: Cross-listener SAN pollution when Gateway has multiple HTTPS listeners #727.

The fix introduces three shared helpers (MatchesWildcardSingleSubdomain, MatchesWildcardAnySubdomain, IsWildcard) and skips foreign hosts when the listener/server has a foreign wildcard pattern. Touches both the legacy controller (pkg/controller/source/gateways/...) and the next-generation certman2 controller.

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

Special notes for your reviewer:
The method MatchesWildcardSingleSubdomain was copied from the external-dns-management repo. Unfortunately, using it directly resulted in new dependencies to provider specific packages. Therefore this approach was reverted.

There is one edge test case, which now returns different results:
With listener host b.example.com and http routes to foo.example.com and bar.example.com, the certificate only contains b.example.com, as non-matching http routes should be ignored according to the API spec.

Release note:

[Gateway source controllers]: Fix cross-listener SAN pollution when gateway has multiple HTTPS listeners

@gardener-prow gardener-prow Bot added the kind/bug Bug label May 18, 2026
@MartinWeindel
Copy link
Copy Markdown
Member Author

/cc @marc1404

@gardener-prow gardener-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 18, 2026
@gardener-prow gardener-prow Bot requested a review from marc1404 May 18, 2026 14:15
@MartinWeindel MartinWeindel force-pushed the fix/gateway-multiple-listeners branch from 8c0655e to 34608ba Compare May 18, 2026 14:29
@gardener-prow gardener-prow Bot added the cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. label May 18, 2026
@MartinWeindel
Copy link
Copy Markdown
Member Author

/test pull-cert-management-integration

@MartinWeindel MartinWeindel changed the title Fix/gateway multiple listeners [Gateway source controllers]: Fix cross-listener SAN pollution when gateway has multiple HTTPS listeners May 18, 2026
@MartinWeindel
Copy link
Copy Markdown
Member Author

/cc @marc1404

Copy link
Copy Markdown
Member

@marc1404 marc1404 left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the SAN pollution issue in both codelines!
Two smaller comments below.

Comment thread pkg/certman2/controller/source/common/reconcilerbase.go Outdated
Comment thread pkg/certman2/controller/source/common/reconcilerbase.go Outdated
… and MatchesWildcardAnySubdomain; go mod tidy
Copy link
Copy Markdown
Member

@marc1404 marc1404 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback! 🙏
/cla
/lgtm
/approve

@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented May 19, 2026

Successfully reached out to cla-assistant.io to initialize recheck of PR #728

@gardener-prow gardener-prow Bot added the lgtm Indicates that a PR is ready to be merged. label May 19, 2026
@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented May 19, 2026

LGTM label has been added.

DetailsGit tree hash: b7b59931e0fe833b92ed26bd0bd2a2085b1df3bb

@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented May 19, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marc1404

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2026
@gardener-prow gardener-prow Bot merged commit 8898800 into master May 19, 2026
30 checks passed
@gardener-prow gardener-prow Bot deleted the fix/gateway-multiple-listeners branch May 19, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/bug Bug lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway API: Cross-listener SAN pollution when Gateway has multiple HTTPS listeners

2 participants