From ad7956dd9cdb7101701db60481a649af13826336 Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Wed, 13 Mar 2024 12:25:44 +0000 Subject: [PATCH] Update nodeSet status on deployment error Signed-off-by: Fabricio Aguiar --- controllers/openstackdataplanenodeset_controller.go | 5 ++++- .../dataplane-deploy-no-nodes-test/05-assert.yaml | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/controllers/openstackdataplanenodeset_controller.go b/controllers/openstackdataplanenodeset_controller.go index c8a6925cc..8d6888d6f 100644 --- a/controllers/openstackdataplanenodeset_controller.go +++ b/controllers/openstackdataplanenodeset_controller.go @@ -409,10 +409,13 @@ func checkDeployment(helper *helper.Helper, instance.Status.DeploymentStatuses = make(map[string]condition.Conditions) } instance.Status.DeploymentStatuses[deployment.Name] = deploymentConditions + if condition.IsError(deployment.Status.Conditions.Get(condition.ReadyCondition)) { + err = fmt.Errorf("check deploymentStatuses for more details") + } } } - return deploymentExists, isDeploymentReady, nil + return deploymentExists, isDeploymentReady, err } // SetupWithManager sets up the controller with the Manager. diff --git a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/05-assert.yaml b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/05-assert.yaml index 9f2f61ba8..be1e6591d 100644 --- a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/05-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/05-assert.yaml @@ -28,12 +28,14 @@ spec: ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret status: conditions: - - message: Deployment in progress - reason: Requested + - message: Deployment error occurred check deploymentStatuses for more details + reason: Error + severity: Error status: "False" type: Ready - - message: Deployment in progress - reason: Requested + - message: Deployment error occurred check deploymentStatuses for more details + reason: Error + severity: Error status: "False" type: DeploymentReady - message: Input data complete