From f4735b62c9c638d611e3650f7baf88b4cf6c8c3a Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Thu, 17 Aug 2023 16:51:52 +0200 Subject: [PATCH] log warning if error and non-zero Result returned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- pkg/internal/controller/controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/internal/controller/controller.go b/pkg/internal/controller/controller.go index b3aac9577d..33883647b9 100644 --- a/pkg/internal/controller/controller.go +++ b/pkg/internal/controller/controller.go @@ -323,6 +323,9 @@ func (c *Controller) reconcileHandler(ctx context.Context, obj interface{}) { } ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Inc() ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelError).Inc() + if !result.IsZero() { + 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") + } log.Error(err, "Reconciler error") case result.RequeueAfter > 0: log.V(5).Info(fmt.Sprintf("Reconcile done, requeueing after %s", result.RequeueAfter))