From 9e7ee9fdd4c127dc44e97bd28470615730120b2b Mon Sep 17 00:00:00 2001 From: Tom Weininger Date: Tue, 28 May 2024 15:12:58 +0000 Subject: [PATCH] Fix previously unset "Ready" conditions ... of types: - RabbitMqTransportURLReady - OctaviaHealthManagerReady - OctaviaHousekeepingReady - OctaviaWorkerReady --- api/v1beta1/conditions.go | 9 +++++++++ controllers/octavia_controller.go | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/api/v1beta1/conditions.go b/api/v1beta1/conditions.go index fe266fc6..9a1273cf 100644 --- a/api/v1beta1/conditions.go +++ b/api/v1beta1/conditions.go @@ -60,6 +60,9 @@ const ( // OctaviaHealthManagerReadyErrorMessage OctaviaHealthManagerReadyErrorMessage = "OctaviaHealthManager error occured %s" + // OctaviaHealthManagerReadyCompleteMessage + OctaviaHealthManagerReadyCompleteMessage = "OctaviaHealthManager ready" + // // OctaviaHousekeepingReady condition messages // @@ -69,6 +72,9 @@ const ( // OctaviaAmphoraControllerReadyErrorMessage OctaviaHousekeepingReadyErrorMessage = "OctaviaHousekeeping error occured %s" + // OctaviaHousekeepingReadyCompleteMessage + OctaviaHousekeepingReadyCompleteMessage = "OctaviaHousekeeping ready" + // // OctaviaWorkerReady condition messages // @@ -78,6 +84,9 @@ const ( // OctaviaAmphoraControllerReadyErrorMessage OctaviaWorkerReadyErrorMessage = "OctaviaWorker error occured %s" + // OctaviaWorkerReadyCompleteMessage + OctaviaWorkerReadyCompleteMessage = "OctaviaWorker ready" + // // OctaviaAmphoraCertsReady condition messages // diff --git a/controllers/octavia_controller.go b/controllers/octavia_controller.go index e780c740..50cbec55 100644 --- a/controllers/octavia_controller.go +++ b/controllers/octavia_controller.go @@ -493,6 +493,7 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav Log.Info(fmt.Sprintf("TransportURL %s successfully reconciled - operation: %s", transportURL.Name, string(op))) } + // infra-operator sets SecretName when ready instance.Status.TransportURLSecret = transportURL.Status.SecretName if instance.Status.TransportURLSecret == "" { @@ -504,6 +505,10 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav condition.InputReadyWaitingMessage)) return ctrl.Result{RequeueAfter: time.Duration(10) * time.Second}, nil } + instance.Status.Conditions.MarkTrue( + condition.RabbitMqTransportURLReadyCondition, + condition.RabbitMqTransportURLReadyMessage) + instance.Status.Conditions.MarkTrue(condition.InputReadyCondition, condition.InputReadyMessage) err = octavia.EnsureAmphoraCerts(ctx, instance, helper, &Log) @@ -700,6 +705,10 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone && ampObsGen { + instance.Status.Conditions.MarkTrue( + amphoraControllerReadyCondition(octaviav1.HealthManager), + octaviav1.OctaviaHealthManagerReadyCompleteMessage, + ) Log.Info(fmt.Sprintf("Deployment of OctaviaHealthManager for %s successfully reconciled - operation: %s", instance.Name, string(op))) } @@ -738,6 +747,10 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } if op != controllerutil.OperationResultNone && ampObsGen { + instance.Status.Conditions.MarkTrue( + amphoraControllerReadyCondition(octaviav1.Housekeeping), + octaviav1.OctaviaHousekeepingReadyCompleteMessage, + ) Log.Info(fmt.Sprintf("Deployment of OctaviaHousekeeping for %s successfully reconciled - operation: %s", instance.Name, string(op))) } @@ -766,6 +779,10 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav } } if op != controllerutil.OperationResultNone && ampObsGen { + instance.Status.Conditions.MarkTrue( + amphoraControllerReadyCondition(octaviav1.Worker), + octaviav1.OctaviaWorkerReadyCompleteMessage, + ) Log.Info(fmt.Sprintf("Deployment of OctaviaWorker for %s successfully reconciled - operation: %s", instance.Name, string(op))) } @@ -1391,7 +1408,7 @@ func (r *OctaviaReconciler) checkOctaviaAPIGeneration( return true, nil } -// checkAmphoraGeneration - +// checkAmphoraGeneration - Checks whether all amp controllers have the same Generation as ObservedGeneration and returns true in that case func (r *OctaviaReconciler) checkAmphoraGeneration( instance *octaviav1.Octavia, ) (bool, error) {