Skip to content

Commit

Permalink
add log when reconciliation is skipped (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Oct 4, 2023
1 parent 6cad3c3 commit 4cfa290
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/tortoise_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 4cfa290

Please sign in to comment.