Skip to content

Commit 96a2020

Browse files
authored
Merge pull request kubernetes#3037 from feiskyer/fix-vmss
Remove checking for VMSS provisioningState before scaling
2 parents 1b057c3 + 0ba8ca6 commit 96a2020

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

cluster-autoscaler/cloudprovider/azure/azure_scale_set.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
4141
"github.com/Azure/go-autorest/autorest"
4242
"github.com/Azure/go-autorest/autorest/azure"
43-
"github.com/Azure/go-autorest/autorest/to"
4443
)
4544

4645
var (
@@ -268,17 +267,9 @@ func (scaleSet *ScaleSet) SetScaleSetSize(size int64) error {
268267
return rerr.Error()
269268
}
270269

271-
// Abort scaling to avoid concurrent VMSS scaling if the VMSS is still under updating.
272-
// Note that the VMSS provisioning state would be updated per scaleSet.sizeRefreshPeriod.
273-
if vmssInfo.VirtualMachineScaleSetProperties != nil && strings.EqualFold(to.String(vmssInfo.VirtualMachineScaleSetProperties.ProvisioningState), string(compute.ProvisioningStateUpdating)) {
274-
klog.Errorf("VMSS %q is still under updating, waiting for it finishes before scaling", scaleSet.Name)
275-
return fmt.Errorf("VMSS %q is still under updating", scaleSet.Name)
276-
}
277-
278270
// Update the new capacity to cache.
279271
vmssSizeMutex.Lock()
280272
vmssInfo.Sku.Capacity = &size
281-
vmssInfo.VirtualMachineScaleSetProperties.ProvisioningState = to.StringPtr(string(compute.ProvisioningStateUpdating))
282273
vmssSizeMutex.Unlock()
283274

284275
// Compose a new VMSS for updating.

cluster-autoscaler/cloudprovider/azure/azure_scale_set_test.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"net/http"
2222
"testing"
23-
"time"
2423

2524
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
2625
"github.com/Azure/go-autorest/autorest"
@@ -126,30 +125,10 @@ func TestIncreaseSizeOnVMSSUpdating(t *testing.T) {
126125
provider, err := BuildAzureCloudProvider(manager, nil)
127126
assert.NoError(t, err)
128127

129-
// Scaling should fail because VMSS is still under updating.
128+
// Scaling should continue even VMSS is under updating.
130129
scaleSet, ok := provider.NodeGroups()[0].(*ScaleSet)
131130
assert.True(t, ok)
132131
err = scaleSet.IncreaseSize(1)
133-
assert.Equal(t, fmt.Errorf("VMSS %q is still under updating", scaleSet.Name), err)
134-
135-
// Scaling should succeed after VMSS ProvisioningState changed to succeeded.
136-
scaleSetClient.FakeStore = map[string]map[string]compute.VirtualMachineScaleSet{
137-
"test": {
138-
vmssName: {
139-
Name: &vmssName,
140-
Sku: &compute.Sku{
141-
Capacity: &vmssCapacity,
142-
},
143-
VirtualMachineScaleSetProperties: &compute.VirtualMachineScaleSetProperties{
144-
ProvisioningState: to.StringPtr(string(compute.ProvisioningStateSucceeded)),
145-
},
146-
},
147-
},
148-
}
149-
scaleSetStatusCache.mutex.Lock()
150-
scaleSetStatusCache.lastRefresh = time.Now().Add(-1 * scaleSet.sizeRefreshPeriod)
151-
scaleSetStatusCache.mutex.Unlock()
152-
err = scaleSet.IncreaseSize(1)
153132
assert.NoError(t, err)
154133
}
155134

0 commit comments

Comments
 (0)