Skip to content

Commit 6c0617d

Browse files
committed
Fix status condition when bmhref changes
At present when bmhRef changes nodeset status condition is not set correctly as provResult var is shadowed by declaring in the inner scope.
1 parent 3bcc472 commit 6c0617d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

controllers/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
367367
return ctrl.Result{}, err
368368
}
369369
containerImages := dataplaneutil.GetContainerImages(version)
370-
provResult := deployment.ProvisionResult{}
370+
var provResult deployment.ProvisionResult
371371
// Reconcile BaremetalSet if required
372372
if !instance.Spec.PreProvisioned {
373373
// Reset the NodeSetBareMetalProvisionReadyCondition to unknown
374374
instance.Status.Conditions.MarkUnknown(dataplanev1.NodeSetBareMetalProvisionReadyCondition,
375375
condition.InitReason, condition.InitReason)
376376

377-
provResult, err := deployment.DeployBaremetalSet(ctx, helper, instance,
377+
provResult, err = deployment.DeployBaremetalSet(ctx, helper, instance,
378378
allIPSets, dnsDetails.ServerAddresses, containerImages)
379379
if err != nil || !provResult.IsProvisioned {
380380
return ctrl.Result{}, err
@@ -517,10 +517,11 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
517517
} else if deploymentConditions.IsFalse(dataplanev1.NodeSetDeploymentReadyCondition) {
518518
isDeploymentRunning = true
519519
} else if deploymentConditions.IsTrue(dataplanev1.NodeSetDeploymentReadyCondition) {
520-
// If the nodeset configHash does not match with what's in the deployment and
520+
// If the nodeset configHash does not match with what's in the deployment or
521521
// deployedBmhHash is different from current bmhRefHash.
522522
if (deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash) ||
523-
(!instance.Spec.PreProvisioned && instance.Status.DeployedBmhHash != bmhRefHash) {
523+
(!instance.Spec.PreProvisioned && instance.Status.DeployedBmhHash != "" &&
524+
instance.Status.DeployedBmhHash != bmhRefHash) {
524525
continue
525526
}
526527
isDeploymentReady = true

0 commit comments

Comments
 (0)