From 113ea274e6e9ccb8146c87e48f3a92607848dd7e Mon Sep 17 00:00:00 2001 From: Tom Weininger Date: Fri, 19 Apr 2024 11:32:05 +0000 Subject: [PATCH] Update Octavia Controller's ready condition Take ready conditions of other services into account as well. --- api/v1beta1/octavia_types.go | 18 ++++++++++++++---- controllers/amphoracontroller_controller.go | 1 - 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/api/v1beta1/octavia_types.go b/api/v1beta1/octavia_types.go index 37acc5b2..ee7ef91d 100644 --- a/api/v1beta1/octavia_types.go +++ b/api/v1beta1/octavia_types.go @@ -302,11 +302,21 @@ func init() { SchemeBuilder.Register(&Octavia{}, &OctaviaList{}) } -// IsReady - returns true if service is ready to server requests +// IsReady - returns true if services are ready to serve requests func (instance Octavia) IsReady() bool { - ready := instance.Status.OctaviaAPIReadyCount > 0 - // TODO: add other ready counts - return ready + readyCounts := []int32{ + instance.Status.OctaviaAPIReadyCount, + instance.Status.OctaviaHealthManagerReadyCount, + instance.Status.OctaviaHousekeepingReadyCount, + instance.Status.OctaviaWorkerReadyCount, + } + + for _, readyCount := range readyCounts { + if readyCount < 1 { + return false + } + } + return true } // SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks) diff --git a/controllers/amphoracontroller_controller.go b/controllers/amphoracontroller_controller.go index 7c3fc4d9..7d1a8bcb 100644 --- a/controllers/amphoracontroller_controller.go +++ b/controllers/amphoracontroller_controller.go @@ -485,7 +485,6 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context } else { Log.Info("Not all conditions are ready for Amphora controller") } - Log.Info("Reconciled Service successfully") return ctrl.Result{}, nil }