From 30a8f936e2dacbb0eec26daff5d42d2f876d9cbd Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Mon, 28 Sep 2020 09:36:29 -0500 Subject: [PATCH] Fix logging for next run delay We were logging the spec interval duration, which was incorrect: 1. On failures, which use exponential backoff 2. On dependency not ready, which uses a separately defined static interval. This changes to log result.RequeueAfter directly when set. --- controllers/helmrelease_controller.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers/helmrelease_controller.go b/controllers/helmrelease_controller.go index 2c7dc9a91..92567f9c8 100644 --- a/controllers/helmrelease_controller.go +++ b/controllers/helmrelease_controller.go @@ -132,10 +132,11 @@ func (r *HelmReleaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) } // Log reconciliation duration - log.Info(fmt.Sprintf("reconcilation finished in %s, next run in %s", - time.Now().Sub(start).String(), - hr.Spec.Interval.Duration.String(), - )) + durationMsg := fmt.Sprintf("reconcilation finished in %s", time.Now().Sub(start).String()) + if result.RequeueAfter > 0 { + durationMsg = fmt.Sprintf("%s, next run in %s", durationMsg, result.RequeueAfter.String()) + } + log.Info(durationMsg) return result, err }