Skip to content

Commit acc381a

Browse files
gnolongapecloud-bot
authored andcommitted
chore: support fixed requeue rate for pod not-found error (#9961)
(cherry picked from commit 201d60b)
1 parent 043930a commit acc381a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

controllers/dataprotection/restore_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ func (r *RestoreReconciler) handleRunningPhase(reqCtx intctrlutil.RequestCtx, re
315315
r.Recorder.Event(restore, corev1.EventTypeWarning, dprestore.ReasonRestoreFailed, err.Error())
316316
err = nil
317317
}
318+
if intctrlutil.IsTargetError(err, intctrlutil.ErrorTypeRequeue) {
319+
r.Recorder.Event(restore, corev1.EventTypeWarning, corev1.EventTypeWarning, err.Error())
320+
return intctrlutil.RequeueAfter(reconcileInterval, reqCtx.Log, "")
321+
}
318322
// patch restore status if changes occur
319323
if !reflect.DeepEqual(restoreMgr.OriginalRestore.Status, restoreMgr.Restore.Status) {
320324
err = r.Client.Status().Patch(reqCtx.Ctx, restoreMgr.Restore, client.MergeFrom(restoreMgr.OriginalRestore))

pkg/dataprotection/restore/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ func (r *RestoreManager) BuildPostReadyActionJobs(reqCtx intctrlutil.RequestCtx,
627627
return nil, err
628628
}
629629
if len(targetPodList.Items) == 0 {
630-
return nil, fmt.Errorf("can not found any pod by spec.readyConfig.%s.target.podSelector", msgKey)
630+
return nil, intctrlutil.NewErrorf(intctrlutil.ErrorTypeRequeue, "can not found any pod by spec.readyConfig.%s.target.podSelector", msgKey)
631631
}
632632
return targetPodList, nil
633633
}

0 commit comments

Comments
 (0)