Skip to content

Commit 29c1ee2

Browse files
committed
Don't reset deployment status when generation has not changed
This would be the case when we remove certain redundant fields during update.
1 parent f03ace0 commit 29c1ee2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

controllers/dataplane/openstackdataplanenodeset_controller.go

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

183187
// Always patch the instance status when exiting this function so we can persist any changes.
184188
defer func() { // update the Ready condition based on the sub conditions
@@ -381,7 +385,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
381385
}
382386

383387
isDeploymentReady, isDeploymentRunning, isDeploymentFailed, failedDeployment, err := checkDeployment(
384-
ctx, helper, instance)
388+
ctx, helper, instance, generationChanged)
385389
if !isDeploymentFailed && err != nil {
386390
instance.Status.Conditions.MarkFalse(
387391
condition.DeploymentReadyCondition,
@@ -460,6 +464,7 @@ func (r *OpenStackDataPlaneNodeSetReconciler) Reconcile(ctx context.Context, req
460464

461465
func checkDeployment(ctx context.Context, helper *helper.Helper,
462466
instance *dataplanev1.OpenStackDataPlaneNodeSet,
467+
generationChanged bool,
463468
) (bool, bool, bool, string, error) {
464469
// Get all completed deployments
465470
var failedDeployment string
@@ -514,7 +519,12 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
514519
} else if deploymentConditions.IsFalse(dataplanev1.NodeSetDeploymentReadyCondition) {
515520
isDeploymentRunning = true
516521
} else if deploymentConditions.IsTrue(dataplanev1.NodeSetDeploymentReadyCondition) {
517-
if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash {
522+
// If the nodeset configHash does not match with what's in the deployment and the
523+
// generation metadata has changed i.e generation metatdata won't change when
524+
// fields are removed from the CRD during an update that would not require a new
525+
// deployment to run).
526+
if deployment.Status.NodeSetHashes[instance.Name] != instance.Status.ConfigHash &&
527+
generationChanged {
518528
continue
519529
}
520530
isDeploymentReady = true

0 commit comments

Comments
 (0)