Skip to content

Commit 42a3c6a

Browse files
Merge pull request #1344 from rabi/revert_status
Revert "Don't reset deployment status when generation has not changed"
2 parents 4253c71 + a28844a commit 42a3c6a

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

controllers/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
179179
// this reconcile loop.
180180
instance.InitConditions()
181181
// Set ObservedGeneration since we've reset conditions
182-
var generationChanged bool
183-
if instance.Generation != instance.Status.ObservedGeneration {
184-
instance.Status.ObservedGeneration = instance.Generation
185-
generationChanged = true
186-
}
182+
instance.Status.ObservedGeneration = instance.Generation
187183

188184
// Always patch the instance status when exiting this function so we can persist any changes.
189185
defer func() { // update the Ready condition based on the sub conditions
@@ -386,7 +382,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
386382
}
387383

388384
isDeploymentReady, isDeploymentRunning, isDeploymentFailed, failedDeployment, err := checkDeployment(
389-
ctx, helper, instance, generationChanged, provResult.BmhRefHash)
385+
ctx, helper, instance, provResult.BmhRefHash)
390386
if !isDeploymentFailed && err != nil {
391387
instance.Status.Conditions.MarkFalse(
392388
condition.DeploymentReadyCondition,
@@ -466,7 +462,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
466462

467463
func checkDeployment(ctx context.Context, helper *helper.Helper,
468464
instance *dataplanev1.OpenStackDataPlaneNodeSet,
469-
generationChanged bool, bmhRefHash string,
465+
bmhRefHash string,
470466
) (bool, bool, bool, string, error) {
471467
// Get all completed deployments
472468
var failedDeployment string
@@ -521,12 +517,9 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
521517
} else if deploymentConditions.IsFalse(dataplanev1.NodeSetDeploymentReadyCondition) {
522518
isDeploymentRunning = true
523519
} else if deploymentConditions.IsTrue(dataplanev1.NodeSetDeploymentReadyCondition) {
524-
// If the nodeset configHash does not match with what's in the deployment and the
525-
// generation metadata has changed (i.e generation metatdata won't change when
526-
// fields are removed from the CRD during an update that would not require a new
527-
// deployment to run) asssume nodeset has changed requiring new deployment.
528-
if (deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash &&
529-
generationChanged) ||
520+
// If the nodeset configHash does not match with what's in the deployment and
521+
// deployedBmhHash is different from current bmhRefHash.
522+
if (deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash) ||
530523
(!instance.Spec.PreProvisioned && instance.Status.DeployedBmhHash != bmhRefHash) {
531524
continue
532525
}

0 commit comments

Comments
 (0)