Skip to content

Commit

Permalink
Merge pull request #3510 from marwanad/dont-update-capacity-if-updating
Browse files Browse the repository at this point in the history
dont update capacity if VMSS provisioning state is updating
  • Loading branch information
k8s-ci-robot authored Sep 15, 2020
2 parents 63259fb + 6da62d0 commit 24c1f90
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
)

var (
Expand Down Expand Up @@ -218,6 +219,12 @@ func (scaleSet *ScaleSet) getCurSize() (int64, error) {
return -1, rerr.Error()
}

// If VMSS state is updating, return the currentSize which would've been proactively incremented or decremented by CA
if set.VirtualMachineScaleSetProperties != nil && strings.EqualFold(to.String(set.VirtualMachineScaleSetProperties.ProvisioningState), string(compute.ProvisioningStateUpdating)) {
klog.V(5).Infof("VMSS %q is in updating state, returning cached size: %d", scaleSet.Name, scaleSet.curSize)
return scaleSet.curSize, nil
}

vmssSizeMutex.Lock()
curSize := *set.Sku.Capacity
vmssSizeMutex.Unlock()
Expand Down

0 comments on commit 24c1f90

Please sign in to comment.