ceph: retry reconcile immediately after cancellation

If the reconcile is cancelled due to a CR update, we want to retry the next
reconcile immediately rather than wait for the exponential backoff timeout
if the reconcile was already failing. The wait can easily be minutes
if the reconcile was in this state, which makes it appear the operator
is ignoring the request to start a new reconcile.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2021-07-02 08:23:25 -06:00
1 parent 889a082734
commit c39c1c7ddf
2 files changed
+13 -1

No files matched your search

@@ -43,12 +43,19 @@ const (
// OperatorNotInitializedMessage is the message we print when the Operator is not ready to reconcile, typically the ceph.conf has not been generated yet
OperatorNotInitializedMessage = "skipping reconcile since operator is still initializing"
// CancellingOrchestrationMessage is the message to indicate a reconcile was cancelled
CancellingOrchestrationMessage = "CANCELLING CURRENT ORCHESTRATION"
)
var (
// ImmediateRetryResult Return this for a immediate retry of the reconciliation loop with the same request object.
ImmediateRetryResult = reconcile.Result{Requeue: true}
// ImmediateRetryResultNoBackoff Return this for a immediate retry of the reconciliation loop with the same request object.
// Override the exponential backoff behavior by setting the RequeueAfter time explicitly.
ImmediateRetryResultNoBackoff = reconcile.Result{Requeue: true, RequeueAfter: time.Second}
// WaitForRequeueIfCephClusterNotReady waits for the CephCluster to be ready
WaitForRequeueIfCephClusterNotReady = reconcile.Result{Requeue: true, RequeueAfter: 10 * time.Second}
@@ -80,7 +87,7 @@ func CheckForCancelledOrchestration(context *clusterd.Context) error {
// Check whether we need to cancel the orchestration
if context.RequestCancelOrchestration.IsSet() {
return errors.New("CANCELLING CURRENT ORCHESTRATION")
return errors.New(CancellingOrchestrationMessage)
}
return nil