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

WIP: Updates clusterapi cloudprovider DecreaseTargetSize #312

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func (ng *nodegroup) DeleteNodes(nodes []*corev1.Node) error {
// nodegroup will not delete the existing nodes when there is an option
// to just decrease the target. Implementation required.
func (ng *nodegroup) DecreaseTargetSize(delta int) error {
klog.V(4).Infof("%s: DecreaseTargetSize called", ng.scalableResource.Name())
if delta >= 0 {
return fmt.Errorf("size decrease must be negative")
}
Expand All @@ -196,10 +197,11 @@ func (ng *nodegroup) DecreaseTargetSize(delta int) error {
}

if size+delta < len(nodes) {
return fmt.Errorf("attempt to delete existing nodes targetSize:%d delta:%d existingNodes: %d",
size, delta, len(nodes))
klog.V(4).Infof("%s: DecreaseTargetSize: attempt to delete existing nodes, current replicas: %d, delta: %d, existing nodes: %d, skipping", ng.scalableResource.Name(), size, delta, len(nodes))
return nil
}

klog.V(4).Infof("%s: DecreaseTargetSize: scaling down: targetSize: %d, delta: %d, existingNodes: %d", ng.scalableResource.Name(), size, delta, len(nodes))
return ng.scalableResource.SetSize(size + delta)
}

Expand Down