@@ -462,24 +462,19 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
462462}
463463
464464func checkDeployment (ctx context.Context , helper * helper.Helper ,
465- instance * dataplanev1.OpenStackDataPlaneNodeSet ,
466- ) ( bool , bool , bool , string , error ) {
465+ instance * dataplanev1.OpenStackDataPlaneNodeSet ) ( isDeploymentReady bool , isDeploymentRunning bool , isDeploymentFailed bool , failedDeploymentName string , err error ) {
466+
467467 // Get all completed deployments
468- var failedDeployment string
469468 deployments := & dataplanev1.OpenStackDataPlaneDeploymentList {}
470469 opts := []client.ListOption {
471470 client .InNamespace (instance .Namespace ),
472471 }
473- err : = helper .GetClient ().List (ctx , deployments , opts ... )
472+ err = helper .GetClient ().List (ctx , deployments , opts ... )
474473 if err != nil {
475474 helper .GetLogger ().Error (err , "Unable to retrieve OpenStackDataPlaneDeployment CRs %v" )
476- return false , false , false , failedDeployment , err
475+ return isDeploymentReady , isDeploymentRunning , isDeploymentFailed , failedDeploymentName , err
477476 }
478477
479- var isDeploymentReady bool
480- var isDeploymentRunning bool
481- var isDeploymentFailed bool
482-
483478 // Sort deployments from oldest to newest by the LastTransitionTime of
484479 // their DeploymentReadyCondition
485480 slices .SortFunc (deployments .Items , func (a , b dataplanev1.OpenStackDataPlaneDeployment ) int {
@@ -512,7 +507,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
512507 if condition .IsError (deploymentCondition ) {
513508 err = fmt .Errorf (deploymentCondition .Message )
514509 isDeploymentFailed = true
515- failedDeployment = deployment .Name
510+ failedDeploymentName = deployment .Name
516511 break
517512 } else if deploymentConditions .IsFalse (dataplanev1 .NodeSetDeploymentReadyCondition ) {
518513 isDeploymentRunning = true
@@ -557,7 +552,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
557552 err := helper .GetClient ().Get (ctx , name , service )
558553 if err != nil {
559554 helper .GetLogger ().Error (err , "Unable to retrieve OpenStackDataPlaneService %v" )
560- return false , false , false , failedDeployment , err
555+ return isDeploymentReady , isDeploymentRunning , isDeploymentFailed , failedDeploymentName , err
561556 }
562557
563558 if service .Spec .EDPMServiceType != "update" {
@@ -573,7 +568,7 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
573568 }
574569 }
575570
576- return isDeploymentReady , isDeploymentRunning , isDeploymentFailed , failedDeployment , err
571+ return isDeploymentReady , isDeploymentRunning , isDeploymentFailed , failedDeploymentName , err
577572}
578573
579574// SetupWithManager sets up the controller with the Manager.
0 commit comments