K8SPG-804: Fix internal.percona.com/delete-backup finalizer#1182
Merged
Conversation
internal.percona.com/delete-backup finalizerinternal.percona.com/delete-backup finalizer
pooknull
marked this pull request as ready for review
June 27, 2025 08:23
pooknull
requested review from
egegunes,
gkech,
hors and
nmarukovich
as code owners
June 27, 2025 08:23
egegunes
previously approved these changes
Jun 27, 2025
gkech
previously approved these changes
Jun 27, 2025
hors
approved these changes
Jun 30, 2025
Collaborator
commit: 6e5dec0 |
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-804
DESCRIPTION
Problem:
On rare occasions, after executing the finalizer
internal.percona.com/delete-backup, operator creates a second backup job for singlepg-backupresource. After that, it is not possible to start new backupsCause:
The
internal.percona.com/keep-jobfinalizer tries to delete thepostgres-operator.crunchydata.com/pgbackrest-backupannotation from thepostgrescluster. Afterwards, it deletes the labels from the backup job so that they are not included in therepoResources.manualBackupJobsused in thereconcileManualBackupmethod.If the job is included in
reconcileManualBackup, it gets stuck at https://github.com/percona/percona-postgresql-operator/blob/02cb95c196a93ff03ce044[...]af1f1fe9f0505/internal/controller/postgrescluster/pgbackrest.go, because the finalizerinternal.percona.com/keep-jobis present in the backup job.The
reconcileManualBackupmethod creates a new backup job if there is no backup job with these labels and thepostgres-operator.crunchydata.com/pgbackrest-backupannotation is specified.However, on rare occasions, crunchy's reconcile process can have an outdated version of
postgresclusterwith this annotation specified when it shouldn't be, while having the latest state of the jobs. In this case, the method doesn't find any backup jobs with labels, but it does see the annotation and creates a new backup job which the operator doesn't control. It is expected that backup labels will be deleted from the backup job after each backup.Solution:
Fetch the latest state of the
postgresclustercluster in thereconcileManualBackupmethod.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability