K8SPG-1045: rewrite cert-management-policy test - #1749
Open
pooknull wants to merge 6 commits into
Open
Conversation
pooknull
requested review from
DhruthiKV,
egegunes,
eleo007,
gkech,
hors,
jvpasinatto,
mayankshah1607,
nmarukovich,
oksana-grishchenko and
valmiranogueira
as code owners
August 11, 2026 22:20
pooknull
marked this pull request as draft
August 11, 2026 22:20
11 tasks
11 tasks
pooknull
marked this pull request as ready for review
August 12, 2026 11:24
egegunes
approved these changes
Aug 13, 2026
eleo007
reviewed
Aug 13, 2026
eleo007
left a comment
Contributor
There was a problem hiding this comment.
Nice-to-have: add to test writing & verifying written data and making a backup.
Also, why do we test only userProvidedOnly? Auto is default and is covered by our other tests?
mayankshah1607
approved these changes
Aug 13, 2026
Contributor
Author
I would like to add it in a separate PR, because currently failing
Auto is default, so there shouldn't be any problems. |
Collaborator
commit: faa1979 |
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:
The previous test was flaky because it expected
.status.conditionsto appear in a specific order. Kubernetes doesn't sort conditions, so each condition should be checked independently.The test itself was also incorrect. It created a cluster with
certManagementPolicy: auto, saved the operator-generated TLS secrets, deleted the cluster, and restored those secrets for a newly created cluster usingcertManagementPolicy: userProvidedOnly.This left the new cluster with an invalid pgbackrest client certificate. The test did not detect the problem because it checked only pod's readiness.
Cause:
pgbackrest authorizes clients using a certificate CN in this format:
The repo host's
tls-server-authsetting and operator-generated pgbackrest certificate CN's are using this format.After recreation,
PostgresClusterhas a differentUID. So, the certificate contained theUIDof the deleted cluster and was rejected by the new repo host.Solution:
Rewrite the test to create a cluster directly with
certManagementPolicy: userProvidedOnlyand generate certificates usingopenssland verify that pods are working correctly.This PR also contains a fix described in the #1736 PR
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability