@@ -371,22 +371,22 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
371371 return ctrl.Result {}, err
372372 }
373373 containerImages := dataplaneutil .GetContainerImages (version )
374-
374+ provResult := deployment. ProvisionResult {}
375375 // Reconcile BaremetalSet if required
376376 if ! instance .Spec .PreProvisioned {
377377 // Reset the NodeSetBareMetalProvisionReadyCondition to unknown
378378 instance .Status .Conditions .MarkUnknown (dataplanev1 .NodeSetBareMetalProvisionReadyCondition ,
379379 condition .InitReason , condition .InitReason )
380380
381- isReady , err := deployment .DeployBaremetalSet (ctx , helper , instance ,
381+ provResult , err := deployment .DeployBaremetalSet (ctx , helper , instance ,
382382 allIPSets , dnsDetails .ServerAddresses , containerImages )
383- if err != nil || ! isReady {
383+ if err != nil || ! provResult . IsProvisioned {
384384 return ctrl.Result {}, err
385385 }
386386 }
387387
388388 isDeploymentReady , isDeploymentRunning , isDeploymentFailed , failedDeployment , err := checkDeployment (
389- ctx , helper , instance , generationChanged )
389+ ctx , helper , instance , generationChanged , provResult . BmhRefHash )
390390 if ! isDeploymentFailed && err != nil {
391391 instance .Status .Conditions .MarkFalse (
392392 condition .DeploymentReadyCondition ,
@@ -430,6 +430,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
430430 Log .Info ("Set NodeSet DeploymentReadyCondition true" )
431431 instance .Status .Conditions .MarkTrue (condition .DeploymentReadyCondition ,
432432 condition .DeploymentReadyMessage )
433+ instance .Status .DeployedBmhHash = provResult .BmhRefHash
433434 } else if isDeploymentRunning {
434435 Log .Info ("Deployment still running..." , "instance" , instance )
435436 Log .Info ("Set NodeSet DeploymentReadyCondition false" )
@@ -465,7 +466,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
465466
466467func checkDeployment (ctx context.Context , helper * helper.Helper ,
467468 instance * dataplanev1.OpenStackDataPlaneNodeSet ,
468- generationChanged bool ,
469+ generationChanged bool , bmhRefHash string ,
469470) (bool , bool , bool , string , error ) {
470471 // Get all completed deployments
471472 var failedDeployment string
@@ -524,8 +525,9 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
524525 // generation metadata has changed (i.e generation metatdata won't change when
525526 // fields are removed from the CRD during an update that would not require a new
526527 // deployment to run) asssume nodeset has changed requiring new deployment.
527- if deployment .Status .NodeSetHashes [instance .Name ] != instance .Status .ConfigHash &&
528- generationChanged {
528+ if (deployment .Status .NodeSetHashes [instance .Name ] != instance .Status .ConfigHash &&
529+ generationChanged ) ||
530+ (! instance .Spec .PreProvisioned && instance .Status .DeployedBmhHash != bmhRefHash ) {
529531 continue
530532 }
531533 isDeploymentReady = true
@@ -794,6 +796,5 @@ func (r *OpenStackDataPlaneNodeSetReconciler) GetSpecConfigHash(instance *datapl
794796 if err != nil {
795797 return "" , err
796798 }
797-
798799 return configHash , nil
799800}
0 commit comments