Skip to content

Commit 0fb6f10

Browse files
author
Arvind Thirumurugan
committed
remove usage of SetStagedUpdateRunStatus
Signed-off-by: Arvind Thirumurugan <[email protected]>
1 parent 5864d9c commit 0fb6f10

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

pkg/controllers/updaterun/initialization.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ func (r *Reconciler) validatePlacement(ctx context.Context, updateRun placementv
134134
// Update the apply strategy in the updateRun status using interface methods
135135
updateRunStatus := updateRun.GetStagedUpdateRunStatus()
136136
updateRunStatus.ApplyStrategy = placementSpec.Strategy.ApplyStrategy
137-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
138137

139138
return placementKey, nil
140139
}
@@ -207,8 +206,6 @@ func (r *Reconciler) determinePolicySnapshot(
207206
}
208207
}
209208
updateRunStatus.PolicyObservedClusterCount = clusterCount
210-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
211-
212209
klog.V(2).InfoS("Found the latest policy snapshot", "latestPolicySnapshotObj", policySnapshotRef, "observedClusterCount", updateRunStatus.PolicyObservedClusterCount, "stagedUpdateRunObj", updateRunRef)
213210

214211
if !condition.IsConditionStatusTrue(latestPolicySnapshot.GetCondition(string(placementv1beta1.PolicySnapshotScheduled)), latestPolicySnapshot.GetGeneration()) {
@@ -280,7 +277,6 @@ func (r *Reconciler) collectScheduledClusters(
280277
// For pickAll policy, the observed cluster count is not included in the policy snapshot. We set it to the number of selected bindings.
281278
// TODO (wantjian): refactor this part to update PolicyObservedClusterCount in one place.
282279
updateRunStatus.PolicyObservedClusterCount = len(selectedBindings)
283-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
284280
} else if updateRunStatus.PolicyObservedClusterCount != len(selectedBindings) {
285281
countErr := controller.NewUnexpectedBehaviorError(fmt.Errorf("the number of selected bindings %d is not equal to the observed cluster count %d", len(selectedBindings), updateRunStatus.PolicyObservedClusterCount))
286282
klog.ErrorS(countErr, "Failed to collect bindings", "placement", placementKey, "latestPolicySnapshotObj", policySnapshotRef, "stagedUpdateRunObj", updateRunRef)
@@ -329,7 +325,6 @@ func (r *Reconciler) generateStagesByStrategy(
329325
updateRunStatus := updateRun.GetStagedUpdateRunStatus()
330326
updateStrategySpec := updateStrategy.GetStagedUpdateStrategySpec()
331327
updateRunStatus.StagedUpdateStrategySnapshot = updateStrategySpec
332-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
333328

334329
// Remove waitTime from the updateRun status for AfterStageTask for type Approval.
335330
removeWaitTimeFromUpdateRunStatus(updateRun)
@@ -351,12 +346,10 @@ func (r *Reconciler) generateStagesByStrategy(
351346
})
352347

353348
// Update deletion stage status using interface methods
354-
updateRunStatus = updateRun.GetStagedUpdateRunStatus()
355349
updateRunStatus.DeletionStageStatus = &placementv1beta1.StageUpdatingStatus{
356350
StageName: placementv1beta1.UpdateRunDeleteStageName,
357351
Clusters: toBeDeletedClusters,
358352
}
359-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
360353
return nil
361354
}
362355

@@ -478,7 +471,6 @@ func (r *Reconciler) computeRunStageStatus(
478471

479472
// Update the stages status using interface methods
480473
updateRunStatus.StagesStatus = stagesStatus
481-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
482474

483475
// Check if the clusters are all placed.
484476
if len(allPlacedClusters) != len(allSelectedClusters) {
@@ -593,8 +585,6 @@ func (r *Reconciler) recordOverrideSnapshots(ctx context.Context, placementKey t
593585
}
594586
}
595587

596-
// Update the status back using interface method
597-
updateRun.SetStagedUpdateRunStatus(*updateRunStatus)
598588
return nil
599589
}
600590

0 commit comments

Comments
 (0)