-
Notifications
You must be signed in to change notification settings - Fork 204
K8SPXC-1214: add .spec.backup.ttlSecondsAfterFinished field
#2234
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
deploy/cr.yaml
Outdated
| backup: | ||
| # allowParallel: true | ||
| image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0-backup | ||
| # ttlSecondsAfterFinished: 60 |
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.
people might understand this as a recommendation and 60 seconds is too short, especially for failed backups. let's make it something like 3600
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.
And for example for restore we have the same problem. We run job and could delete it before the cluster becomes ready.
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.
| for _, jobName := range []string{ | ||
| naming.RestoreJobName(cr, false), | ||
| naming.RestoreJobName(cr, true), | ||
| } { | ||
| if err := k8sretry.RetryOnConflict(k8sretry.DefaultRetry, func() error { | ||
| job := new(batchv1.Job) | ||
| if err := r.client.Get(ctx, types.NamespacedName{ | ||
| Name: jobName, | ||
| Namespace: cr.Namespace, | ||
| }, job); err != nil { | ||
| if k8serrors.IsNotFound(err) { | ||
| return nil | ||
| } | ||
| return errors.Wrap(err, "failed to get job") | ||
| } | ||
| job.Finalizers = slices.DeleteFunc(job.Finalizers, func(s string) bool { return s == naming.FinalizerKeepJob }) | ||
| return r.client.Update(ctx, job) | ||
| }); err != nil { | ||
| return reconcile.Result{}, errors.Wrap(err, "failed to remove keep-job finalizer") | ||
| } | ||
| } |
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.
can we move this to a separate function like we do in backup controller?
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.
commit: ff96f03 |
| backup: | ||
| # allowParallel: true | ||
| image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0-backup | ||
| # ttlSecondsAfterFinished: 3600 |
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 do we have helm chart PR?
https://perconadev.atlassian.net/browse/K8SPXC-1214
DESCRIPTION
This PR adds a new field:
.spec.backup.ttlSecondsAfterFinished.The value will be applied to both backup and restore jobs.
To prevent breaking backup or restore processes when a small
ttlSecondsAfterFinishedvalue is used, a new finalizer,internal.percona.com/keep-job, has been introduced.This finalizer will be added to every backup and restore job and will be removed once the corresponding
pxc-backuporpxc-restoreresource reaches its finalSucceededorFailedstate.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability