Skip to content

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Apr 17, 2025

K8SPG-703 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPG-703

DESCRIPTION

Problem:
Backup jobs may be deleted before they are finished (e.g. via ttlSecondsAfterFinished), causing pg-backup to be stuck in the Running 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

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

@pooknull pooknull marked this pull request as ready for review April 18, 2025 14:40
Copy link
Collaborator

@hors hors left a 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

@pooknull pooknull requested a review from hors April 22, 2025 06:49
@@ -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 {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@egegunes egegunes left a 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

@egegunes
Copy link
Contributor

egegunes commented May 5, 2025

@pooknull ping

@hors hors requested review from egegunes and gkech May 12, 2025 18:32
gkech
gkech previously approved these changes May 13, 2025
egegunes
egegunes previously approved these changes May 19, 2025
@pooknull pooknull dismissed stale reviews from egegunes and gkech via 1994190 May 20, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants