Skip to content

Commit de7ae41

Browse files
author
James Goodhouse
committed
disable surging if externally managed autoscaler is used
1 parent e3e0852 commit de7ae41

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
@@ -618,7 +618,7 @@ func TestReconcileVMSS(t *testing.T) {
618618
m.GetResultIfDone(gomockinternal.AContext(), patchFuture).Return(compute.VirtualMachineScaleSet{}, azure.NewOperationNotDoneError(patchFuture))
619619
m.Get(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(clone, nil)
620620
m.ListInstances(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(instances, nil)
621-
s.HasReplicasExternallyManaged(gomockinternal.AContext()).Return(false)
621+
s.HasReplicasExternallyManaged(gomockinternal.AContext()).Times(2).Return(false)
622622
},
623623
},
624624
{

0 commit comments

Comments
 (0)