Skip to content

Commit 304027b

Browse files
authored
Merge pull request #2451 from sbueringer/pr-log-warn
🌱 log warning if error and non-zero Result returned
2 parents 480fc5b + f4735b6 commit 304027b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/internal/controller/controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ func (c *Controller) reconcileHandler(ctx context.Context, obj interface{}) {
323323
}
324324
ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Inc()
325325
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelError).Inc()
326+
if !result.IsZero() {
327+
log.Info("Warning: Reconciler returned both a non-zero result and a non-nil error. The result will always be ignored if the error is non-nil and the non-nil error causes reqeueuing with exponential backoff. For more details, see: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler")
328+
}
326329
log.Error(err, "Reconciler error")
327330
case result.RequeueAfter > 0:
328331
log.V(5).Info(fmt.Sprintf("Reconcile done, requeueing after %s", result.RequeueAfter))

0 commit comments

Comments
 (0)