K8SPG-1150: added spec.tls.SANs - #1813
Open
yoav-katz wants to merge 6 commits into
Open
Conversation
yoav-katz
requested review from
DhruthiKV,
egegunes,
eleo007,
gkech,
hors,
jvpasinatto,
mayankshah1607,
nmarukovich,
oksana-grishchenko,
pooknull and
valmiranogueira
as code owners
September 1, 2026 19:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
egegunes
reviewed
Sep 2, 2026
Collaborator
commit: 2ae23c2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Every SAN on an operator-issued certificate is derived from
naming.ServiceDNSNamesplusspec.clusterServiceDNSSuffix. There is no way for a user to add a name of their own, sosslmode=verify-fullfails for anyone reaching Postgres or pgBouncer through a name theoperator does not know about: an external hostname, a blue/green or per-tenant CNAME, a
legacy name kept through a migration, a wildcard, or a corporate/air-gapped DNS zone.
An external-DNS integration would only ever cover the single hostname external-DNS manages.
Solution:
Add an optional
spec.tls.SANslist, appended to the DNS names of the Postgres servercertificate and the pgBouncer frontend certificate, on both the cert-manager and the
internal-PKI paths.
The API is a deliberate copy of the MySQL operators, which already ship this exact field
(
SANs []stringwith json tagSANs, flat-appended ontoDNSNames).Our
TLSSpecwas already nearly field-identical to PXC's, so this is a one-field addition with no new API shape.Also fixes a latent bug this feature depends on: the "existing Certificate" branch of
ApplyClusterCertificate/ApplyPGBouncerCertificatereconciled only ownerRefs, durationand issuerRef - never
Spec.DNSNames. Without that, setting SANs on an already-runningcluster was a permanent no-op.
ApplyPGBackRestClientCertificatealready did thiscorrectly; the fix copies its shape.
Known limitation, matching MySQL: a bare IP entry becomes a
dNSNameSAN, not aniPAddressSAN, soverify-fullagainst an IP still fails. Making it work meansthreading
ipAddresses []net.IPthroughinternal/pkiand its 7 call sites - deferred,marked with a comment at the append site.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability