Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #3242: Disable increaseSize when the node group is under initialilzation. #3246

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -71,6 +71,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 @@ -214,6 +215,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 @@ -297,6 +297,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