From 600de1949f986d4b960a96b2fa3ec0e644ff491d Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Wed, 17 Apr 2024 17:28:44 +0200 Subject: [PATCH] Fix ObsGen condition As per the agreement in [1], the controller should evaluate the current CR readiness only when the Generation matches with the ObservedGeneration. Any other edge case can be handled by a separate check, but we do not want to risk to reach "ReadyCondition = True" when we see a Generation "<" of the ObservedGeneration. [1] openstack-k8s-operators/dev-docs#102 Signed-off-by: Francesco Pantano --- controllers/glanceapi_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/glanceapi_controller.go b/controllers/glanceapi_controller.go index 87178be1..82e2bb1b 100644 --- a/controllers/glanceapi_controller.go +++ b/controllers/glanceapi_controller.go @@ -829,7 +829,7 @@ func (r *GlanceAPIReconciler) reconcileNormal(ctx context.Context, instance *gla return ctrlResult, nil } - if depl.GetStatefulSet().Generation <= depl.GetStatefulSet().Status.ObservedGeneration { + if depl.GetStatefulSet().Generation == depl.GetStatefulSet().Status.ObservedGeneration { instance.Status.ReadyCount = depl.GetStatefulSet().Status.ReadyReplicas // verify if network attachment matches expectations networkReady := false