Skip to content

Commit

Permalink
synchronize instance deletions to avoid 409 conflict errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marwanad committed Jul 6, 2020
1 parent 05236b9 commit 8476c5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,14 @@ func (scaleSet *ScaleSet) DeleteInstances(instances []*azureRef) error {
defer cancel()
resourceGroup := scaleSet.manager.config.ResourceGroup

scaleSet.instanceMutex.Lock()
klog.V(3).Infof("Calling virtualMachineScaleSetsClient.DeleteInstancesAsync(%v)", requiredIds.InstanceIds)

future, rerr := scaleSet.manager.azClient.virtualMachineScaleSetsClient.DeleteInstancesAsync(ctx, resourceGroup, commonAsg.Id(), *requiredIds)
if rerr != nil {
klog.Errorf("virtualMachineScaleSetsClient.DeleteInstancesAsync for instances %v failed: %v", requiredIds.InstanceIds, err)
return rerr.Error()
}
scaleSet.instanceMutex.Unlock()

// Proactively decrement scale set size so that we don't
// go below minimum node count if cache data is stale
Expand Down

0 comments on commit 8476c5d

Please sign in to comment.