From 4cfa290774b6c980b23e15d06f97a236e7be4b26 Mon Sep 17 00:00:00 2001 From: Kensei Nakada Date: Wed, 4 Oct 2023 15:41:52 +0900 Subject: [PATCH] add log when reconciliation is skipped (#143) --- controllers/tortoise_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/tortoise_controller.go b/controllers/tortoise_controller.go index ba198304..59e2874d 100644 --- a/controllers/tortoise_controller.go +++ b/controllers/tortoise_controller.go @@ -72,6 +72,7 @@ type TortoiseReconciler struct { func (r *TortoiseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) { logger := log.FromContext(ctx) now := time.Now() + logger.V(4).Info("the reconciliation is started", "tortoise", req.NamespacedName) tortoise, err := r.TortoiseService.GetTortoise(ctx, req.NamespacedName) if err != nil { @@ -111,6 +112,7 @@ func (r *TortoiseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcileNow, requeueAfter := r.TortoiseService.ShouldReconcileTortoiseNow(tortoise, now) if !reconcileNow { + logger.V(4).Info("the reconciliation is skipped because this tortoise is recently updated", "tortoise", req.NamespacedName) return ctrl.Result{RequeueAfter: requeueAfter}, nil }