Skip to content

Commit 0e87c74

Browse files
authored
Merge pull request #3465 from newrelic-forks/cherry-pick-3440-to-release-1.8
[release-1.8] disable surging if externally managed autoscaler is used
2 parents b1160c3 + 7452032 commit 0e87c74

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

azure/services/scalesets/scalesets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func (s *Service) patchVMSSIfNeeded(ctx context.Context, infraVMSS *azure.VMSS)
298298
if !isFlex {
299299
updated = infraVMSS.HasEnoughLatestModelOrNotMixedModel()
300300
}
301-
if maxSurge > 0 && (hasModelChanges || !updated) {
301+
if maxSurge > 0 && (hasModelChanges || !updated) && !s.Scope.HasReplicasExternallyManaged(ctx) {
302302
// surge capacity with the intention of lowering during instance reconciliation
303303
surge := spec.Capacity + int64(maxSurge)
304304
log.V(4).Info("surging...", "surge", surge, "hasModelChanges", hasModelChanges, "updated", updated)

azure/services/scalesets/scalesets_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func TestReconcileVMSS(t *testing.T) {
617617
m.GetResultIfDone(gomockinternal.AContext(), patchFuture).Return(compute.VirtualMachineScaleSet{}, azure.NewOperationNotDoneError(patchFuture))
618618
m.Get(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(clone, nil)
619619
m.ListInstances(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(instances, nil)
620-
s.HasReplicasExternallyManaged(gomockinternal.AContext()).Return(false)
620+
s.HasReplicasExternallyManaged(gomockinternal.AContext()).Times(2).Return(false)
621621
},
622622
},
623623
{

0 commit comments

Comments
 (0)