From dd28746967b0e81690fbfd37c033b5285a5289d3 Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Mon, 9 Jan 2023 11:07:04 +0530 Subject: [PATCH 1/4] scale-up only new mS while scale-down all active mSs proportionally --- pkg/controller/deployment.go | 4 +- pkg/controller/deployment_sync.go | 110 +++++++++++++++++++----------- pkg/controller/deployment_util.go | 5 ++ 3 files changed, 78 insertions(+), 41 deletions(-) diff --git a/pkg/controller/deployment.go b/pkg/controller/deployment.go index 767139365..9bab8a839 100644 --- a/pkg/controller/deployment.go +++ b/pkg/controller/deployment.go @@ -528,6 +528,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error { } if d.Spec.Paused { + klog.V(3).Infof("TestLog: Scaling detected for machineDeployment %s which is paused", d.Name) return dc.sync(ctx, d, machineSets, machineMap) } @@ -538,12 +539,13 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error { return dc.rollback(ctx, d, machineSets, machineMap) } - scalingEvent, err := dc.isScalingEvent(ctx, d, machineSets, machineMap) + scalingEvent, _, err := dc.isScalingEvent(ctx, d, machineSets, machineMap) if err != nil { return err } if scalingEvent { + klog.V(3).Infof("TestLog: Scaling detected for machineDeployment %s", d.Name) return dc.sync(ctx, d, machineSets, machineMap) } diff --git a/pkg/controller/deployment_sync.go b/pkg/controller/deployment_sync.go index 4c9c3a30a..6bf662b7a 100644 --- a/pkg/controller/deployment_sync.go +++ b/pkg/controller/deployment_sync.go @@ -412,6 +412,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep if (activeOrLatest.Spec.Replicas) == (deployment.Spec.Replicas) { return nil } + klog.V(3).Infof("TestLog: Scaling latest/theOnlyActive machineSet %s", activeOrLatest.Name) _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, activeOrLatest, (deployment.Spec.Replicas), deployment) return err } @@ -419,6 +420,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep // If the new machine set is saturated, old machine sets should be fully scaled down. // This case handles machine set adoption during a saturated new machine set. if IsSaturated(deployment, newIS) { + klog.V(3).Infof("TestLog: Scaling old active machineSets as new machineSet %s is saturated", newIS.Name) for _, old := range FilterActiveMachineSets(oldISs) { if _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, old, 0, deployment); err != nil { return err @@ -428,9 +430,11 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep } // There are old machine sets with machines and the new machine set is not saturated. - // We need to proportionally scale all machine sets (new and old) in case of a - // rolling deployment. + // So the scaling is handled this way: + // - Scale up ? -> scale up only the new machineSet + // - Scale down ? -> scale down the old machineSets proportionally if IsRollingUpdate(deployment) { + klog.V(3).Infof("TestLog: Scaling all active machineSets proportionally for scale-down, while scaling up latest machineSet only for scale-up, machineDeployment %s", deployment.Name) allISs := FilterActiveMachineSets(append(oldISs, newIS)) allISsReplicas := GetReplicaCountForMachineSets(allISs) @@ -441,56 +445,39 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep // Number of additional replicas that can be either added or removed from the total // replicas count. These replicas should be distributed proportionally to the active - // machine sets. + // machine sets in case of scale-down, while added only to the new machineSet during scale-up + klog.V(3).Infof("TestLog: machineDeployment: %s , replicasToAdd: %d, maxAllowedSize: %d, allMachineSetReplicas: %d", deployment.Name, allowedSize, allISsReplicas) deploymentReplicasToAdd := allowedSize - allISsReplicas - // The additional replicas should be distributed proportionally amongst the active - // machine sets from the larger to the smaller in size machine set. Scaling direction - // drives what happens in case we are trying to scale machine sets of the same size. - // In such a case when scaling up, we should scale up newer machine sets first, and - // when scaling down, we should scale down older machine sets first. + // During scale-down, the additional replicas should be distributed proportionally amongst the active + // machine sets from the larger to the smaller in size machine set. + // We should scale down older machine sets first if machine sets are of equal size. + var scalingOperation string + nameToSize := make(map[string]int32) + deploymentReplicasAdded := int32(0) switch { case deploymentReplicasToAdd > 0: - sort.Sort(MachineSetsBySizeNewer(allISs)) scalingOperation = "up" - + nameToSize = dc.scaleNewMachineSet(newIS, allISs, deploymentReplicasToAdd, deployment) + deploymentReplicasAdded = deploymentReplicasToAdd case deploymentReplicasToAdd < 0: - sort.Sort(MachineSetsBySizeOlder(allISs)) scalingOperation = "down" + sort.Sort(MachineSetsBySizeOlder(allISs)) + nameToSize, deploymentReplicasAdded = dc.scaleMachineSetsProportionally(allISs, deploymentReplicasToAdd, deployment) } - // Iterate over all active machine sets and estimate proportions for each of them. - // The absolute value of deploymentReplicasAdded should never exceed the absolute - // value of deploymentReplicasToAdd. - deploymentReplicasAdded := int32(0) - nameToSize := make(map[string]int32) - for i := range allISs { - is := allISs[i] - - // Estimate proportions if we have replicas to add, otherwise simply populate - // nameToSize with the current sizes for each machine set. - if deploymentReplicasToAdd != 0 { - proportion := GetProportion(is, *deployment, deploymentReplicasToAdd, deploymentReplicasAdded) - - nameToSize[is.Name] = (is.Spec.Replicas) + proportion - deploymentReplicasAdded += proportion - } else { - nameToSize[is.Name] = (is.Spec.Replicas) - } - } - - // Update all machine sets for i := range allISs { is := allISs[i] - // Add/remove any leftovers to the largest machine set. + // Incorporate any leftovers to the largest machine set. if i == 0 && deploymentReplicasToAdd != 0 { leftover := deploymentReplicasToAdd - deploymentReplicasAdded nameToSize[is.Name] = nameToSize[is.Name] + leftover if nameToSize[is.Name] < 0 { nameToSize[is.Name] = 0 } + klog.V(3).Infof("TestLog: leftover proportion increase of %d done in largest machineSet %s", leftover, is.Name) } // TODO: Use transactions when we have them. @@ -503,6 +490,41 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep return nil } +func (dc *controller) scaleNewMachineSet(newIS *v1alpha1.MachineSet, allISs []*v1alpha1.MachineSet, deploymentReplicasToAdd int32, deployment *v1alpha1.MachineDeployment) map[string]int32 { + nameToSize := make(map[string]int32) + for _, is := range allISs { + nameToSize[is.Name] = is.Spec.Replicas + } + + nameToSize[newIS.Name] = newIS.Spec.Replicas + deploymentReplicasToAdd + + return nameToSize +} + +func (dc *controller) scaleMachineSetsProportionally(allISs []*v1alpha1.MachineSet, deploymentReplicasToAdd int32, deployment *v1alpha1.MachineDeployment) (map[string]int32, int32) { + // Iterate over all active machine sets and estimate proportions for each of them. + // The absolute value of deploymentReplicasAdded should never exceed the absolute + // value of deploymentReplicasToAdd. + + nameToSize := make(map[string]int32) + deploymentReplicasAdded := int32(0) + for i := range allISs { + is := allISs[i] + // Estimate proportions if we have replicas to add, otherwise simply populate + // nameToSize with the current sizes for each machine set. + if deploymentReplicasToAdd != 0 { + proportion := GetProportion(is, *deployment, deploymentReplicasToAdd, deploymentReplicasAdded) + klog.V(3).Infof("TestLog: final proportion increase for machineSet %s due to parent deployment's replica update is %d", is.Name, proportion) + nameToSize[is.Name] = (is.Spec.Replicas) + proportion + deploymentReplicasAdded += proportion + } else { + nameToSize[is.Name] = (is.Spec.Replicas) + } + } + + return nameToSize, deploymentReplicasAdded +} + func (dc *controller) scaleMachineSetAndRecordEvent(ctx context.Context, is *v1alpha1.MachineSet, newScale int32, deployment *v1alpha1.MachineDeployment) (bool, *v1alpha1.MachineSet, error) { // No need to scale if (is.Spec.Replicas) == newScale { @@ -644,24 +666,32 @@ func calculateDeploymentStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.Ma } // isScalingEvent checks whether the provided deployment has been updated with a scaling event -// by looking at the desired-replicas annotation in the active machine sets of the deployment. +// by looking at the desired-replicas annotation in the active machine sets of the deployment, and returns if there was scale-up or not. // // rsList should come from getReplicaSetsForDeployment(d). // machineMap should come from getmachineMapForDeployment(d, rsList). -func (dc *controller) isScalingEvent(ctx context.Context, d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) (bool, error) { +func (dc *controller) isScalingEvent(ctx context.Context, d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) (bool, bool, error) { newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(ctx, d, isList, machineMap, false) + scaled := false + isScaleUp := false if err != nil { - return false, err + return scaled, isScaleUp, err } allISs := append(oldISs, newIS) for _, is := range FilterActiveMachineSets(allISs) { - desired, ok := GetDesiredReplicasAnnotation(is) + prevDesired, ok := GetDesiredReplicasAnnotation(is) if !ok { continue } - if desired != (d.Spec.Replicas) { - return true, nil + if prevDesired != (d.Spec.Replicas) { + if prevDesired < d.Spec.Replicas { + isScaleUp = true + } + scaled = true + klog.V(4).Infof("(isScalingEvent) Scaling detected for machineDeployment %s. scaled=%s, isScaledUp=%s ", d.Name, scaled, isScaleUp) + break } } - return false, nil + + return scaled, isScaleUp, nil } diff --git a/pkg/controller/deployment_util.go b/pkg/controller/deployment_util.go index e826f4bbd..8e5941f17 100644 --- a/pkg/controller/deployment_util.go +++ b/pkg/controller/deployment_util.go @@ -611,6 +611,8 @@ func SetReplicasAnnotations(is *v1alpha1.MachineSet, desiredReplicas, maxReplica is.Annotations[MaxReplicasAnnotation] = maxString updated = true } + + klog.V(4).Infof("(SetReplicasAnnotations) ms.Name: %s desired: %s , max: %s , updated: %d", is.Name, desiredString, maxString, updated) return updated } @@ -656,6 +658,7 @@ func GetProportion(is *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploy isFraction := getMachineSetFraction(*is, d) allowed := deploymentReplicasToAdd - deploymentReplicasAdded + klog.V(4).Infof("TestLog: allowed proportion increase= %d, proposed proportion increase= %d", allowed, isFraction) if deploymentReplicasToAdd > 0 { // Use the minimum between the machine set fraction and the maximum allowed replicas // when scaling up. This way we ensure we will not scale up more than the allowed @@ -689,6 +692,8 @@ func getMachineSetFraction(is v1alpha1.MachineSet, d v1alpha1.MachineDeployment) // We should never proportionally scale up from zero which means rs.spec.replicas and annotatedReplicas // will never be zero here. newISsize := (float64((is.Spec.Replicas) * deploymentReplicas)) / float64(annotatedReplicas) + + klog.V(4).Infof("TestLog: calculating proportion increase for machineSet %s. ms.desired=%d, maxDeploymentSizePossible=%d, maxDeploymentSizePossibleAsPerAnnotation=%d", is.Name, deploymentReplicas, annotatedReplicas) return integer.RoundToInt32(newISsize) - (is.Spec.Replicas) } From 7a2d6cbb28214dfbd8ab8e4749a29d166f84dc17 Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Tue, 10 Jan 2023 18:44:35 +0530 Subject: [PATCH 2/4] reverting changes to isScalingEvent fn --- pkg/controller/deployment.go | 2 +- pkg/controller/deployment_sync.go | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/pkg/controller/deployment.go b/pkg/controller/deployment.go index 9bab8a839..b31bad1d0 100644 --- a/pkg/controller/deployment.go +++ b/pkg/controller/deployment.go @@ -539,7 +539,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error { return dc.rollback(ctx, d, machineSets, machineMap) } - scalingEvent, _, err := dc.isScalingEvent(ctx, d, machineSets, machineMap) + scalingEvent, err := dc.isScalingEvent(ctx, d, machineSets, machineMap) if err != nil { return err diff --git a/pkg/controller/deployment_sync.go b/pkg/controller/deployment_sync.go index 6bf662b7a..6e29232a5 100644 --- a/pkg/controller/deployment_sync.go +++ b/pkg/controller/deployment_sync.go @@ -670,28 +670,20 @@ func calculateDeploymentStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.Ma // // rsList should come from getReplicaSetsForDeployment(d). // machineMap should come from getmachineMapForDeployment(d, rsList). -func (dc *controller) isScalingEvent(ctx context.Context, d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) (bool, bool, error) { +func (dc *controller) isScalingEvent(ctx context.Context, d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) (bool, error) { newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(ctx, d, isList, machineMap, false) - scaled := false - isScaleUp := false if err != nil { - return scaled, isScaleUp, err + return false, err } allISs := append(oldISs, newIS) for _, is := range FilterActiveMachineSets(allISs) { - prevDesired, ok := GetDesiredReplicasAnnotation(is) + desired, ok := GetDesiredReplicasAnnotation(is) if !ok { continue } - if prevDesired != (d.Spec.Replicas) { - if prevDesired < d.Spec.Replicas { - isScaleUp = true - } - scaled = true - klog.V(4).Infof("(isScalingEvent) Scaling detected for machineDeployment %s. scaled=%s, isScaledUp=%s ", d.Name, scaled, isScaleUp) - break + if desired != (d.Spec.Replicas) { + return true, nil } } - - return scaled, isScaleUp, nil + return false, nil } From e1a54c6e269a84c6259a5eefc3bb414de6f6342f Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Mon, 23 Jan 2023 10:33:18 +0530 Subject: [PATCH 3/4] addressed review comments by unmarshall --- pkg/controller/deployment.go | 4 ++-- pkg/controller/deployment_sync.go | 23 +++++++++-------------- pkg/controller/deployment_util.go | 4 ++-- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/pkg/controller/deployment.go b/pkg/controller/deployment.go index b31bad1d0..3fec35d46 100644 --- a/pkg/controller/deployment.go +++ b/pkg/controller/deployment.go @@ -528,7 +528,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error { } if d.Spec.Paused { - klog.V(3).Infof("TestLog: Scaling detected for machineDeployment %s which is paused", d.Name) + klog.V(3).Infof("Scaling detected for machineDeployment %s which is paused", d.Name) return dc.sync(ctx, d, machineSets, machineMap) } @@ -545,7 +545,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error { return err } if scalingEvent { - klog.V(3).Infof("TestLog: Scaling detected for machineDeployment %s", d.Name) + klog.V(3).Infof("Scaling detected for machineDeployment %s", d.Name) return dc.sync(ctx, d, machineSets, machineMap) } diff --git a/pkg/controller/deployment_sync.go b/pkg/controller/deployment_sync.go index 6e29232a5..31e1ec097 100644 --- a/pkg/controller/deployment_sync.go +++ b/pkg/controller/deployment_sync.go @@ -400,11 +400,6 @@ func (dc *controller) getNewMachineSet(ctx context.Context, d *v1alpha1.MachineD return createdIS, err } -// scale scales proportionally in order to mitigate risk. Otherwise, scaling up can increase the size -// of the new machine set and scaling down can decrease the sizes of the old ones, both of which would -// have the effect of hastening the rollout progress, which could produce a higher proportion of unavailable -// replicas in the event of a problem with the rolled out template. Should run only on scaling events or -// when a deployment is paused and not during the normal rollout process. func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDeployment, newIS *v1alpha1.MachineSet, oldISs []*v1alpha1.MachineSet) error { // If there is only one active machine set then we should scale that up to the full count of the // deployment. If there is no active machine set, then we should scale up the newest machine set. @@ -412,7 +407,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep if (activeOrLatest.Spec.Replicas) == (deployment.Spec.Replicas) { return nil } - klog.V(3).Infof("TestLog: Scaling latest/theOnlyActive machineSet %s", activeOrLatest.Name) + klog.V(3).Infof("Scaling latest/theOnlyActive machineSet %s", activeOrLatest.Name) _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, activeOrLatest, (deployment.Spec.Replicas), deployment) return err } @@ -420,7 +415,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep // If the new machine set is saturated, old machine sets should be fully scaled down. // This case handles machine set adoption during a saturated new machine set. if IsSaturated(deployment, newIS) { - klog.V(3).Infof("TestLog: Scaling old active machineSets as new machineSet %s is saturated", newIS.Name) + klog.V(3).Infof("Scaling old active machineSets as new machineSet %s is saturated", newIS.Name) for _, old := range FilterActiveMachineSets(oldISs) { if _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, old, 0, deployment); err != nil { return err @@ -434,7 +429,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep // - Scale up ? -> scale up only the new machineSet // - Scale down ? -> scale down the old machineSets proportionally if IsRollingUpdate(deployment) { - klog.V(3).Infof("TestLog: Scaling all active machineSets proportionally for scale-down, while scaling up latest machineSet only for scale-up, machineDeployment %s", deployment.Name) + klog.V(3).Infof("Scaling all active machineSets proportionally for scale-in, while scaling up latest machineSet only for scale-out, machineDeployment %s", deployment.Name) allISs := FilterActiveMachineSets(append(oldISs, newIS)) allISsReplicas := GetReplicaCountForMachineSets(allISs) @@ -445,11 +440,11 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep // Number of additional replicas that can be either added or removed from the total // replicas count. These replicas should be distributed proportionally to the active - // machine sets in case of scale-down, while added only to the new machineSet during scale-up - klog.V(3).Infof("TestLog: machineDeployment: %s , replicasToAdd: %d, maxAllowedSize: %d, allMachineSetReplicas: %d", deployment.Name, allowedSize, allISsReplicas) + // machine sets in case of scale-in, while added only to the new machineSet during scale-out + klog.V(3).Infof("machineDeployment: %s , replicasToAdd: %d, maxAllowedSize: %d, allMachineSetReplicas: %d", deployment.Name, allowedSize, allISsReplicas) deploymentReplicasToAdd := allowedSize - allISsReplicas - // During scale-down, the additional replicas should be distributed proportionally amongst the active + // During scale-in, the additional replicas should be distributed proportionally amongst the active // machine sets from the larger to the smaller in size machine set. // We should scale down older machine sets first if machine sets are of equal size. @@ -477,7 +472,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep if nameToSize[is.Name] < 0 { nameToSize[is.Name] = 0 } - klog.V(3).Infof("TestLog: leftover proportion increase of %d done in largest machineSet %s", leftover, is.Name) + klog.V(3).Infof("leftover proportion increase of %d done in largest machineSet %s", leftover, is.Name) } // TODO: Use transactions when we have them. @@ -514,7 +509,7 @@ func (dc *controller) scaleMachineSetsProportionally(allISs []*v1alpha1.MachineS // nameToSize with the current sizes for each machine set. if deploymentReplicasToAdd != 0 { proportion := GetProportion(is, *deployment, deploymentReplicasToAdd, deploymentReplicasAdded) - klog.V(3).Infof("TestLog: final proportion increase for machineSet %s due to parent deployment's replica update is %d", is.Name, proportion) + klog.V(3).Infof("final proportion increase for machineSet %s due to parent deployment's replica update is %d", is.Name, proportion) nameToSize[is.Name] = (is.Spec.Replicas) + proportion deploymentReplicasAdded += proportion } else { @@ -666,7 +661,7 @@ func calculateDeploymentStatus(allISs []*v1alpha1.MachineSet, newIS *v1alpha1.Ma } // isScalingEvent checks whether the provided deployment has been updated with a scaling event -// by looking at the desired-replicas annotation in the active machine sets of the deployment, and returns if there was scale-up or not. +// by looking at the desired-replicas annotation in the active machine sets of the deployment, and returns if there was scale-out or not. // // rsList should come from getReplicaSetsForDeployment(d). // machineMap should come from getmachineMapForDeployment(d, rsList). diff --git a/pkg/controller/deployment_util.go b/pkg/controller/deployment_util.go index 8e5941f17..c90e2ef74 100644 --- a/pkg/controller/deployment_util.go +++ b/pkg/controller/deployment_util.go @@ -658,7 +658,7 @@ func GetProportion(is *v1alpha1.MachineSet, d v1alpha1.MachineDeployment, deploy isFraction := getMachineSetFraction(*is, d) allowed := deploymentReplicasToAdd - deploymentReplicasAdded - klog.V(4).Infof("TestLog: allowed proportion increase= %d, proposed proportion increase= %d", allowed, isFraction) + klog.V(4).Infof("allowed proportion increase= %d, proposed proportion increase= %d", allowed, isFraction) if deploymentReplicasToAdd > 0 { // Use the minimum between the machine set fraction and the maximum allowed replicas // when scaling up. This way we ensure we will not scale up more than the allowed @@ -693,7 +693,7 @@ func getMachineSetFraction(is v1alpha1.MachineSet, d v1alpha1.MachineDeployment) // will never be zero here. newISsize := (float64((is.Spec.Replicas) * deploymentReplicas)) / float64(annotatedReplicas) - klog.V(4).Infof("TestLog: calculating proportion increase for machineSet %s. ms.desired=%d, maxDeploymentSizePossible=%d, maxDeploymentSizePossibleAsPerAnnotation=%d", is.Name, deploymentReplicas, annotatedReplicas) + klog.V(4).Infof("calculating proportion increase for machineSet %s. ms.desired=%d, maxDeploymentSizePossible=%d, maxDeploymentSizePossibleAsPerAnnotation=%d", is.Name, deploymentReplicas, annotatedReplicas) return integer.RoundToInt32(newISsize) - (is.Spec.Replicas) } From 6e1dd36eb9a0b45c8aae43fb6903cc8d69399f2d Mon Sep 17 00:00:00 2001 From: Himanshu Sharma <79965161+himanshu-kun@users.noreply.github.com> Date: Mon, 23 Jan 2023 10:35:08 +0530 Subject: [PATCH 4/4] Remove unneeded parenthesis Co-authored-by: Madhav Bhargava --- pkg/controller/deployment_sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/deployment_sync.go b/pkg/controller/deployment_sync.go index 31e1ec097..bc74e517a 100644 --- a/pkg/controller/deployment_sync.go +++ b/pkg/controller/deployment_sync.go @@ -408,7 +408,7 @@ func (dc *controller) scale(ctx context.Context, deployment *v1alpha1.MachineDep return nil } klog.V(3).Infof("Scaling latest/theOnlyActive machineSet %s", activeOrLatest.Name) - _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, activeOrLatest, (deployment.Spec.Replicas), deployment) + _, _, err := dc.scaleMachineSetAndRecordEvent(ctx, activeOrLatest, deployment.Spec.Replicas, deployment) return err }