Merge pull request #6476 from reasonerjt/del-inprog-dbr

Delete the expired deletebackuprequests that are stuck in "InProgress"
This commit is contained in:
Xun Jiang/Bruce Jiang
2023-07-26 16:13:58 +08:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -0,0 +1 @@
Delete the expired deletebackuprequests that are stuck in "InProgress"

View File

@@ -126,15 +126,16 @@ func (r *backupDeletionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// Since we use the reconciler along with the PeriodicalEnqueueSource, there may be reconciliation triggered by
// stale requests.
if dbr.Status.Phase == velerov1api.DeleteBackupRequestPhaseProcessed {
if dbr.Status.Phase == velerov1api.DeleteBackupRequestPhaseProcessed ||
dbr.Status.Phase == velerov1api.DeleteBackupRequestPhaseInProgress {
age := r.clock.Now().Sub(dbr.CreationTimestamp.Time)
if age >= deleteBackupRequestMaxAge { // delete the expired request
log.Debug("The request is expired, deleting it.")
log.Debugf("The request is expired, status: %s, deleting it.", dbr.Status.Phase)
if err := r.Delete(ctx, dbr); err != nil {
log.WithError(err).Error("Error deleting DeleteBackupRequest")
}
} else {
log.Info("The request has been processed, skip.")
log.Infof("The request has status '%s', skip.", dbr.Status.Phase)
}
return ctrl.Result{}, nil
}