From df3bf9a5552d90c467a722ec768ccc632c8280b5 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Mon, 8 Apr 2024 14:51:27 +0200 Subject: [PATCH] Set ObservedGeneration after condition init Signed-off-by: Francesco Pantano --- controllers/swift_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/swift_controller.go b/controllers/swift_controller.go index 4a70ae58..353a40db 100644 --- a/controllers/swift_controller.go +++ b/controllers/swift_controller.go @@ -148,6 +148,8 @@ func (r *SwiftReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resu ) instance.Status.Conditions.Init(&cl) + // Update the lastObserved generation before evaluating conditions + instance.Status.ObservedGeneration = instance.Generation // If we're not deleting this and the service object doesn't have our finalizer, add it. if instance.DeletionTimestamp.IsZero() && controllerutil.AddFinalizer(instance, helper.GetFinalizer()) || isNewInstance { @@ -335,8 +337,6 @@ func (r *SwiftReconciler) reconcileNormal(ctx context.Context, instance *swiftv1 r.Log.Info(fmt.Sprintf("Reconciled Service '%s' successfully", instance.Name)) - // Update the lastObserved generation before evaluating conditions - instance.Status.ObservedGeneration = instance.Generation // We reached the end of the Reconcile, update the Ready condition based on // the sub conditions if instance.Status.Conditions.AllSubConditionIsTrue() {