Skip to content

Commit

Permalink
Delete the expired deletebackuprequests that are stuck in "InProgress"
Browse files Browse the repository at this point in the history
state

Signed-off-by: Daniel Jiang <[email protected]>
  • Loading branch information
reasonerjt committed Jul 5, 2023
1 parent cd68dd3 commit cf8cd94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/controller/backup_deletion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit cf8cd94

Please sign in to comment.