@@ -179,7 +179,11 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
179179 // this reconcile loop.
180180 instance.InitConditions()
181181 // Set ObservedGeneration since we've reset conditions
182- instance.Status.ObservedGeneration = instance.Generation
182+ var generationChanged bool
183+ if instance.Generation != instance.Status.ObservedGeneration {
184+ instance.Status.ObservedGeneration = instance.Generation
185+ generationChanged = true
186+ }
183187
184188 // Always patch the instance status when exiting this function so we can persist any changes.
185189 defer func() { // update the Ready condition based on the sub conditions
@@ -382,7 +386,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
382386 }
383387
384388 isDeploymentReady, isDeploymentRunning, isDeploymentFailed, failedDeployment, err := checkDeployment(
385- ctx, helper, instance)
389+ ctx, helper, instance, generationChanged )
386390 if !isDeploymentFailed && err != nil {
387391 instance.Status.Conditions.MarkFalse(
388392 condition.DeploymentReadyCondition,
@@ -461,6 +465,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
461465
462466func checkDeployment(ctx context.Context, helper *helper.Helper,
463467 instance *dataplanev1.OpenStackDataPlaneNodeSet,
468+ generationChanged bool,
464469) (bool, bool, bool, string, error) {
465470 // Get all completed deployments
466471 var failedDeployment string
@@ -515,7 +520,12 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
515520 } else if deploymentConditions.IsFalse(dataplanev1.NodeSetDeploymentReadyCondition) {
516521 isDeploymentRunning = true
517522 } else if deploymentConditions.IsTrue(dataplanev1.NodeSetDeploymentReadyCondition) {
518- if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash {
523+ // If the nodeset configHash does not match with what's in the deployment and the
524+ // generation metadata has changed i.e generation metatdata won't change when
525+ // fields are removed from the CRD during an update that would not require a new
526+ // deployment to run).
527+ if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash &&
528+ generationChanged {
519529 continue
520530 }
521531 isDeploymentReady = true
0 commit comments