Skip to content

Commit 1402518

Browse files
committed
fix comments
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
1 parent d81e20e commit 1402518

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/controllers/updaterun/execution.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ func (r *Reconciler) executeUpdatingStage(
166166
for i := 0; i < len(updatingStageStatus.Clusters) && clusterUpdatingCount < maxConcurrency; i++ {
167167
clusterStatus := &updatingStageStatus.Clusters[i]
168168
clusterUpdateSucceededCond := meta.FindStatusCondition(clusterStatus.Conditions, string(placementv1beta1.ClusterUpdatingConditionSucceeded))
169-
if condition.IsConditionStatusTrueIgnoreGeneration(clusterUpdateSucceededCond) { // Ignoring generation here as once cluster succeeded in a previous Run state, generation may be different from current generation due state changing.
169+
// Ignoring generation here as once cluster succeeded in a previous Run state, generation may be different from current generation due state changing.
170+
if condition.IsConditionStatusTrueIgnoreGeneration(clusterUpdateSucceededCond) {
170171
// The cluster has been updated successfully.
171172
finishedClusterCount++
172173
continue
173174
}
174175
clusterUpdatingCount++
175-
if condition.IsConditionStatusFalseIgnoreGeneration(clusterUpdateSucceededCond) { // Ignoring generation here as once cluster failed, it won't change as the update run is aborted on failure.
176+
// Ignoring generation here as once cluster failed, it won't change as the update run is aborted on failure.
177+
if condition.IsConditionStatusFalseIgnoreGeneration(clusterUpdateSucceededCond) {
176178
// The cluster is marked as failed to update, this cluster is counted as updating cluster since it's not finished to avoid processing more clusters than maxConcurrency in this round.
177179
failedErr := fmt.Errorf("the cluster `%s` in the stage %s has failed", clusterStatus.ClusterName, updatingStageStatus.StageName)
178180
klog.ErrorS(failedErr, "The cluster has failed to be updated", "updateRun", updateRunRef)
@@ -182,7 +184,8 @@ func (r *Reconciler) executeUpdatingStage(
182184
// The cluster needs to be processed.
183185
clusterStartedCond := meta.FindStatusCondition(clusterStatus.Conditions, string(placementv1beta1.ClusterUpdatingConditionStarted))
184186
binding := toBeUpdatedBindingsMap[clusterStatus.ClusterName]
185-
if !condition.IsConditionStatusTrueIgnoreGeneration(clusterStartedCond) { // Ignoring generation here as once cluster started in a previous Run state, generation may be different from current generation due state changing
187+
// Ignoring generation here as once cluster started in a previous Run state, generation may be different from current generation due state changing.
188+
if !condition.IsConditionStatusTrueIgnoreGeneration(clusterStartedCond) {
186189
// The cluster has not started updating yet.
187190
if !isBindingSyncedWithClusterStatus(resourceSnapshotName, updateRun, binding, clusterStatus) {
188191
klog.V(2).InfoS("Found the first cluster that needs to be updated", "cluster", clusterStatus.ClusterName, "stage", updatingStageStatus.StageName, "updateRun", updateRunRef)
@@ -344,7 +347,8 @@ func (r *Reconciler) executeDeleteStage(
344347
for i := range existingDeleteStageStatus.Clusters {
345348
existingDeleteStageClusterMap[existingDeleteStageStatus.Clusters[i].ClusterName] = &existingDeleteStageStatus.Clusters[i]
346349
}
347-
// Mark the stage as started if not already marked or previously false (resumed after update run has stopped). Ignoring generation here as stage progressing generation, generation may be different from current generation due state changing.
350+
// Mark the stage as started if not already marked or previously false (resumed after update run has stopped).
351+
// Ignoring generation here as stage progressing generation, generation may be different from current generation due state changing.
348352
if !condition.IsConditionStatusTrueIgnoreGeneration(meta.FindStatusCondition(existingDeleteStageStatus.Conditions, string(placementv1beta1.StageUpdatingConditionProgressing))) {
349353
markStageUpdatingStarted(updateRunStatus.DeletionStageStatus, updateRun.GetGeneration())
350354
}

0 commit comments

Comments
 (0)