Merge pull request #15885 from rook/mergify/bp/release-1.17/pr-15884

core: improve reporting for reconcile requeue cases (backport #15884)
This commit is contained in:
Travis Nielsen authored and GitHub committed 2025-05-21 08:34:38 -06:00
commit daa694fafc
4 files changed
+13 -3

No files matched your search

+3
View File
@@ -5306,6 +5306,9 @@ deletion.</p>
</tr><tr><td><p>&#34;ReconcileFailed&#34;</p></td>
<td><p>ReconcileFailed represents when a resource reconciliation failed.</p>
</td>
</tr><tr><td><p>&#34;ReconcileRequeuing&#34;</p></td>
<td><p>ReconcileRequeuing represents when a resource reconciliation requeue.</p>
</td>
</tr><tr><td><p>&#34;ReconcileStarted&#34;</p></td>
<td><p>ReconcileStarted represents when a resource reconciliation started.</p>
</td>
+2 -1
View File
@@ -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
+4
View File
@@ -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)
@@ -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) {