-
Notifications
You must be signed in to change notification settings - Fork 61
K8SPG-703: add internal.percona.com/keep-job
finalizer for backups
#1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pooknull please check tests
commit: 94b3bad |
@@ -265,6 +274,21 @@ func (r *PGBackupReconciler) Reconcile(ctx context.Context, request reconcile.Re | |||
|
|||
return reconcile.Result{}, nil | |||
case v2.BackupSucceeded: | |||
job, err := findBackupJob(ctx, r.Client, pgBackup) | |||
if err == nil && len(job.Finalizers) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we assert that the specific finalizer we created for this PR, If it is set, and instead we are checking if the job finalizers are not empty? If we decide at some point to have more finalizers for some reason, what would happen to this logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to address @gkech's comment
https://perconadev.atlassian.net/browse/K8SPG-703
DESCRIPTION
Problem:
Backup jobs may be deleted before they are finished (e.g. via
ttlSecondsAfterFinished
), causingpg-backup
to be stuck in theRunning
state.Solution:
Add
internal.percona.com/keep-job
finalizer to backup jobs to prevent them from being deleted while they are running. The finalizer should be automatically removed when the backup finishes or fails.CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
Config/Logging/Testability