Skip to content

Commit

Permalink
Fix previously unset "Ready" conditions
Browse files Browse the repository at this point in the history
... of types:
- RabbitMqTransportURLReady
- OctaviaHealthManagerReady
- OctaviaHousekeepingReady
- OctaviaWorkerReady
  • Loading branch information
weinimo committed Jun 3, 2024
1 parent 3627caa commit 9e7ee9f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const (
// OctaviaHealthManagerReadyErrorMessage
OctaviaHealthManagerReadyErrorMessage = "OctaviaHealthManager error occured %s"

// OctaviaHealthManagerReadyCompleteMessage
OctaviaHealthManagerReadyCompleteMessage = "OctaviaHealthManager ready"

//
// OctaviaHousekeepingReady condition messages
//
Expand All @@ -69,6 +72,9 @@ const (
// OctaviaAmphoraControllerReadyErrorMessage
OctaviaHousekeepingReadyErrorMessage = "OctaviaHousekeeping error occured %s"

// OctaviaHousekeepingReadyCompleteMessage
OctaviaHousekeepingReadyCompleteMessage = "OctaviaHousekeeping ready"

//
// OctaviaWorkerReady condition messages
//
Expand All @@ -78,6 +84,9 @@ const (
// OctaviaAmphoraControllerReadyErrorMessage
OctaviaWorkerReadyErrorMessage = "OctaviaWorker error occured %s"

// OctaviaWorkerReadyCompleteMessage
OctaviaWorkerReadyCompleteMessage = "OctaviaWorker ready"

//
// OctaviaAmphoraCertsReady condition messages
//
Expand Down
19 changes: 18 additions & 1 deletion controllers/octavia_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand All @@ -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)
Expand Down Expand Up @@ -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)))
}

Expand Down Expand Up @@ -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)))
}

Expand Down Expand Up @@ -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)))
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9e7ee9f

Please sign in to comment.