From 5631715a23f49bfaa0d0611e8b2c23033fad80c6 Mon Sep 17 00:00:00 2001 From: Paul Laffitte Date: Thu, 8 Aug 2024 17:47:47 +0200 Subject: [PATCH] fix: cachedimages with non-nil expiresAt where not updated --- internal/controller/kuik/cachedimage_controller.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/controller/kuik/cachedimage_controller.go b/internal/controller/kuik/cachedimage_controller.go index 39767040..d3631d01 100644 --- a/internal/controller/kuik/cachedimage_controller.go +++ b/internal/controller/kuik/cachedimage_controller.go @@ -230,8 +230,6 @@ func (r *CachedImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) } r.Recorder.Eventf(&cachedImage, "Normal", "Expired", "Image %s successfully expired", cachedImage.Spec.SourceImage) return ctrl.Result{}, nil - } else { - return ctrl.Result{RequeueAfter: time.Until(expiresAt.Time)}, nil } } @@ -264,6 +262,11 @@ func (r *CachedImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) } log.Info("cachedimage reconciled") + + if !expiresAt.IsZero() { + return ctrl.Result{RequeueAfter: time.Until(expiresAt.Time)}, nil + } + return ctrl.Result{}, nil }