Skip to content

Commit 9d05726

Browse files
committed
address comments
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
1 parent 3e3eb79 commit 9d05726

File tree

6 files changed

+878
-714
lines changed

6 files changed

+878
-714
lines changed

apis/placement/v1beta1/stageupdate_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ const (
427427
// Its condition status can be one of the following:
428428
// - "True": The staged update run is making progress.
429429
// - "False": The staged update run is waiting/paused/abandoned.
430-
// - "Unknown": The staged update run is in the process of stopping.
430+
// - "Unknown": The staged update run is in a transitioning state.
431431
StagedUpdateRunConditionProgressing StagedUpdateRunConditionType = "Progressing"
432432

433433
// StagedUpdateRunConditionSucceeded indicates whether the staged update run is completed successfully.
@@ -490,7 +490,7 @@ const (
490490
// Its condition status can be one of the following:
491491
// - "True": The stage updating is making progress.
492492
// - "False": The stage updating is waiting.
493-
// - "Unknown": The staged update run is in the process of stopping.
493+
// - "Unknown": The staged updating is a transitioning state.
494494
StageUpdatingConditionProgressing StageUpdatingConditionType = "Progressing"
495495

496496
// StageUpdatingConditionSucceeded indicates whether the stage updating is completed successfully.

pkg/controllers/updaterun/controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req runtime.Request) (runtim
176176
return runtime.Result{}, r.recordUpdateRunSucceeded(ctx, updateRun)
177177
}
178178

179-
return r.handleIncompleteUpdateRun(ctx, updateRun, waitTime, execErr, state, runObjRef)
179+
return r.updateUpdateRunStatus(ctx, updateRun, waitTime, execErr, state, runObjRef)
180180
case placementv1beta1.StateStop:
181181
// Stop the updateRun.
182182
klog.V(2).InfoS("Stopping the updateRun", "state", state, "updatingStageIndex", updatingStageIndex, "updateRun", runObjRef)
@@ -191,7 +191,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req runtime.Request) (runtim
191191
return runtime.Result{}, r.recordUpdateRunStopped(ctx, updateRun)
192192
}
193193

194-
return r.handleIncompleteUpdateRun(ctx, updateRun, waitTime, stopErr, state, runObjRef)
194+
return r.updateUpdateRunStatus(ctx, updateRun, waitTime, stopErr, state, runObjRef)
195195

196196
default:
197197
// Initialize, Run, or Stop are the only supported states.
@@ -202,7 +202,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req runtime.Request) (runtim
202202
return runtime.Result{}, nil
203203
}
204204

205-
func (r *Reconciler) handleIncompleteUpdateRun(ctx context.Context, updateRun placementv1beta1.UpdateRunObj, waitTime time.Duration, err error, state placementv1beta1.State, runObjRef klog.ObjectRef) (runtime.Result, error) {
205+
func (r *Reconciler) updateUpdateRunStatus(ctx context.Context, updateRun placementv1beta1.UpdateRunObj, waitTime time.Duration, err error, state placementv1beta1.State, runObjRef klog.ObjectRef) (runtime.Result, error) {
206206
// The execution or stopping is not finished yet or it encounters a retriable error.
207207
// We need to record the status and requeue.
208208
if updateErr := r.recordUpdateRunStatus(ctx, updateRun); updateErr != nil {
@@ -211,6 +211,7 @@ func (r *Reconciler) handleIncompleteUpdateRun(ctx context.Context, updateRun pl
211211

212212
klog.V(2).InfoS("The updateRun is not finished yet", "state", state, "requeueWaitTime", waitTime, "err", err, "updateRun", runObjRef)
213213

214+
// Return execution or stopping retriable error if any.
214215
if err != nil {
215216
return runtime.Result{}, err
216217
}

pkg/controllers/updaterun/execution.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,7 @@ func calculateMaxConcurrencyValue(status *placementv1beta1.UpdateRunStatus, stag
554554
func aggregateUpdateRunStatus(updateRun placementv1beta1.UpdateRunObj, stageName string, stuckClusterNames []string) {
555555
if len(stuckClusterNames) > 0 {
556556
markUpdateRunStuck(updateRun, stageName, strings.Join(stuckClusterNames, ", "))
557-
} else if updateRun.GetUpdateRunSpec().State == placementv1beta1.StateStop {
558-
// If there is no stuck cluster and the update run state is stop, mark the update run as stopping.
559-
markUpdateRunStopping(updateRun)
560-
} else {
557+
} else if updateRun.GetUpdateRunSpec().State == placementv1beta1.StateRun {
561558
// If there is no stuck cluster but some progress has been made, mark the update run as progressing.
562559
markUpdateRunProgressing(updateRun)
563560
}

0 commit comments

Comments
 (0)