diff --git a/Documentation/CRDs/specification.md b/Documentation/CRDs/specification.md index 57c79c9ab..0597ca9b1 100644 --- a/Documentation/CRDs/specification.md +++ b/Documentation/CRDs/specification.md @@ -5306,6 +5306,9 @@ deletion.

"ReconcileFailed"

ReconcileFailed represents when a resource reconciliation failed.

+

"ReconcileRequeuing"

+

ReconcileRequeuing represents when a resource reconciliation requeue.

+

"ReconcileStarted"

ReconcileStarted represents when a resource reconciliation started.

diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index a251f9254..383934744 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -559,7 +559,8 @@ const ( ReconcileFailed ConditionReason = "ReconcileFailed" // ReconcileStarted represents when a resource reconciliation started. ReconcileStarted ConditionReason = "ReconcileStarted" - + // ReconcileRequeuing represents when a resource reconciliation requeue. + ReconcileRequeuing ConditionReason = "ReconcileRequeuing" // DeletingReason represents when Rook has detected a resource object should be deleted. DeletingReason ConditionReason = "Deleting" // ObjectHasDependentsReason represents when a resource object has dependents that are blocking diff --git a/pkg/operator/ceph/reporting/reporting.go b/pkg/operator/ceph/reporting/reporting.go index 0c4c9a0e6..dde20385a 100644 --- a/pkg/operator/ceph/reporting/reporting.go +++ b/pkg/operator/ceph/reporting/reporting.go @@ -156,6 +156,10 @@ func ReportReconcileResult( // intent. return reconcileResponse, nil } + } else if reconcileResponse.Requeue { + msg := fmt.Sprintf("requeuing %s %q", kind, nsName) + logger.Debug(msg) + recorder.Event(objCopy, corev1.EventTypeNormal, string(cephv1.ReconcileRequeuing), msg) } else { successMsg := fmt.Sprintf("successfully configured %s %q", kind, nsName) diff --git a/pkg/operator/ceph/reporting/reporting_test.go b/pkg/operator/ceph/reporting/reporting_test.go index e86a3aef8..5a9fa7029 100644 --- a/pkg/operator/ceph/reporting/reporting_test.go +++ b/pkg/operator/ceph/reporting/reporting_test.go @@ -94,6 +94,8 @@ func TestReportReconcileResult(t *testing.T) { successMsg := `successfully configured CephCluster "rook-ceph/my-cluster"` successEvent := `Normal ReconcileSucceeded ` + successMsg + requeueMsg := `requeuing CephCluster "rook-ceph/my-cluster"` + requeueEvent := `Normal ReconcileRequeuing ` + requeueMsg fakeErr := errors.New("fake-err") errorMsg := `failed to reconcile CephCluster "rook-ceph/my-cluster". fake-err` @@ -131,9 +133,9 @@ func TestReportReconcileResult(t *testing.T) { cephCluster, inResult, nil) assert.NoError(t, err) assert.Equal(t, inResult, result) - assert.Equal(t, successMsg, strings.TrimSpace(logBuf.String())) + assert.Equal(t, requeueMsg, strings.TrimSpace(logBuf.String())) assert.Len(t, recorder.Events, 1) - assert.Equal(t, successEvent, <-recorder.Events) + assert.Equal(t, requeueEvent, <-recorder.Events) }) t.Run("failed reconcile with requeue", func(t *testing.T) {