Skip to content

Commit ad3f8da

Browse files
author
Arvind Thirumurugan
committed
parse maxConcurrency
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
1 parent b0dbbf1 commit ad3f8da

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/controllers/updaterun/execution.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/apimachinery/pkg/api/meta"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/types"
32+
"k8s.io/apimachinery/pkg/util/intstr"
3233
utilerrors "k8s.io/apimachinery/pkg/util/errors"
3334
"k8s.io/klog/v2"
3435
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -69,8 +70,13 @@ func (r *Reconciler) execute(
6970

7071
updateRunStatus := updateRun.GetUpdateRunStatus()
7172
if updatingStageIndex < len(updateRunStatus.StagesStatus) {
73+
// Round down the maxConcurrency to the number of clusters in the stage.
74+
maxConcurrency, err := intstr.GetScaledValueFromIntOrPercent(updateRunStatus.UpdateStrategySnapshot.Stages[updatingStageIndex].MaxConcurrency, len(updateRunStatus.StagesStatus[updatingStageIndex].Clusters), false)
75+
if err != nil {
76+
return false, 0, err
77+
}
7278
updatingStage := &updateRunStatus.StagesStatus[updatingStageIndex]
73-
waitTime, execErr := r.executeUpdatingStage(ctx, updateRun, updatingStageIndex, toBeUpdatedBindings, 1)
79+
waitTime, execErr := r.executeUpdatingStage(ctx, updateRun, updatingStageIndex, toBeUpdatedBindings, maxConcurrency)
7480
if errors.Is(execErr, errStagedUpdatedAborted) {
7581
markStageUpdatingFailed(updatingStage, updateRun.GetGeneration(), execErr.Error())
7682
return true, waitTime, execErr

0 commit comments

Comments
 (0)