Skip to content

Commit

Permalink
Disable increaseSize when the node group is under initialilzation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilo19 committed Jun 25, 2020
1 parent c31848d commit 4bf3e47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func NewAgentPool(spec *dynamic.NodeGroupSpec, az *AzureManager) (*AgentPool, er
minSize: spec.MinSize,
maxSize: spec.MaxSize,
manager: az,
curSize: -1,
}

if err := as.initialize(); err != nil {
Expand Down Expand Up @@ -302,6 +303,10 @@ func (as *AgentPool) IncreaseSize(delta int) error {
as.mutex.Lock()
defer as.mutex.Unlock()

if as.curSize == -1 {
return fmt.Errorf("the availability set %s is under initialization, skipping IncreaseSize", as.Name)
}

if delta <= 0 {
return fmt.Errorf("size increase must be positive")
}
Expand Down
4 changes: 4 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ func (scaleSet *ScaleSet) IncreaseSize(delta int) error {
return err
}

if size == -1 {
return fmt.Errorf("the scale set %s is under initialization, skipping IncreaseSize", scaleSet.Name)
}

if int(size)+delta > scaleSet.MaxSize() {
return fmt.Errorf("size increase too large - desired:%d max:%d", int(size)+delta, scaleSet.MaxSize())
}
Expand Down

0 comments on commit 4bf3e47

Please sign in to comment.