K8SPG-1045: fix certManagementPolicy for pgbouncer - #1736
Closed
pooknull wants to merge 1 commit into
Closed
Conversation
pooknull
requested review from
egegunes,
gkech,
hors,
mayankshah1607,
nmarukovich and
oksana-grishchenko
as code owners
August 7, 2026 11:25
Collaborator
commit: 3a81ed2 |
egegunes
approved these changes
Aug 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes PgBouncer TLS handling under userProvidedOnly.
Changes:
- Preserves standard-secret TLS data while reconciling non-TLS values.
- Validates configured custom PgBouncer TLS secrets.
- Adds unit coverage for policy behavior and CA preservation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/pgbouncer/reconcile.go |
Updates Secret and Pod TLS handling. |
internal/pgbouncer/reconcile_test.go |
Tests TLS policy behavior. |
internal/controller/postgrescluster/pki.go |
Checks the configured custom TLS Secret. |
internal/controller/postgrescluster/pki_test.go |
Tests custom-secret readiness checks. |
internal/controller/postgrescluster/pgbouncer.go |
Continues non-TLS Secret reconciliation. |
Suppressed comments (1)
internal/pgbouncer/reconcile.go:200
- For
userProvidedOnlypluscustomTLSSecret, this always passesfalse, sofrontendCertificatekeeps mounting only the custom Secret's CA and never projects the mergedadditionalTrustedCAsbundle. Preserve the custom-Secret exception here so configured additional authorities remain trusted.
len(inCluster.Spec.Proxy.PGBouncer.AdditionalTrustedCAs) > 0 &&
inCluster.Spec.TLS.GetCertManagementPolicy() != v1beta1.CertManagementUserProvidedOnly)...),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+332
to
333
| if err == nil && cluster.Spec.TLS.GetCertManagementPolicy() != v1beta1.CertManagementUserProvidedOnly { | ||
| additionalTrustedCAs, err = r.getAdditionalTrustedCAs(ctx, cluster) |
Comment on lines
+147
to
+148
| if err == nil && len(additionalCAs) > 0 && | ||
| inCluster.Spec.TLS.GetCertManagementPolicy() != v1beta1.CertManagementUserProvidedOnly { |
Member
|
@pooknull please check Copilot comments and resolve conflicts |
pooknull
added a commit
that referenced
this pull request
Aug 12, 2026
11 tasks
Contributor
Author
|
#1749 will replace this PR |
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.
https://perconadev.atlassian.net/browse/K8SPG-1045
DESCRIPTION
Problem:
PR #1679 added
.spec.tls.certManagementPolicy. When set touserProvidedOnly, the operator skips reconcile of the entire pgbouncer secret, including non-TLS values it should manage. Also, when.spec.proxy.pgbouncer.customTLSSecretis configured, the operator validates the standard pgbouncer secret instead of thecustomTLSSecret.Solution:
Preserve user-provided TLS values in the standard pgbouncer secret while continuing to reconcile operator-managed non-TLS values. When
.spec.proxy.pgbouncer.customTLSSecretis configured, validate that secret instead of the standard pgbouncer Secret.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability