diff --git a/controllers/dashboard_controller.go b/controllers/dashboard_controller.go index 2bca69091..18e1f2f3d 100644 --- a/controllers/dashboard_controller.go +++ b/controllers/dashboard_controller.go @@ -256,8 +256,10 @@ func (r *GrafanaDashboardReconciler) Reconcile(ctx context.Context, req ctrl.Req // if the dashboard was successfully synced in all instances, wait for its re-sync period if success { + if cr.ResyncPeriodHasElapsed() { + cr.Status.LastResync = metav1.Time{Time: time.Now()} + } cr.Status.Hash = hash - cr.Status.LastResync = metav1.Time{Time: time.Now()} cr.Status.UID = uid return ctrl.Result{RequeueAfter: cr.GetResyncPeriod()}, r.Client.Status().Update(ctx, cr) } diff --git a/controllers/datasource_controller.go b/controllers/datasource_controller.go index 9f27206b5..e4ad23bf3 100644 --- a/controllers/datasource_controller.go +++ b/controllers/datasource_controller.go @@ -250,7 +250,9 @@ func (r *GrafanaDatasourceReconciler) Reconcile(ctx context.Context, req ctrl.Re if success { cr.Status.LastMessage = "" cr.Status.Hash = hash - cr.Status.LastResync = metav1.Time{Time: time.Now()} + if cr.ResyncPeriodHasElapsed() { + cr.Status.LastResync = metav1.Time{Time: time.Now()} + } cr.Status.UID = datasource.UID return ctrl.Result{RequeueAfter: cr.GetResyncPeriod()}, r.Client.Status().Update(ctx, cr) } else {