Skip to content

Commit

Permalink
feat(upcloud): implement node group AtomicIncreaseSize method (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
peknur authored Aug 7, 2024
1 parent e51500c commit f39f057
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cluster-autoscaler/cloudprovider/upcloud/upcloud_node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,17 @@ func (u *upCloudNodeGroup) TemplateNodeInfo() (*schedulerframework.NodeInfo, err
klog.V(logDebug).Infof("UpCloud %s/NodeGroup.TemplateNodeInfo called", u.Id())
return nil, cloudprovider.ErrNotImplemented
}

// AtomicIncreaseSize tries to increase the size of the node group atomically.
// - If the method returns nil, it guarantees that delta instances will be added to the node group
// within its MaxNodeProvisionTime. The function should wait until node group size is updated.
// The cloud provider is responsible for tracking and ensuring successful scale up asynchronously.
// - If the method returns an error, it guarantees that no new instances will be added to the node group
// as a result of this call. The cloud provider is responsible for ensuring that before returning from the method.
//
// Implementation is optional. If implemented, CA will take advantage of the method while scaling up
// GenericScaleUp ProvisioningClass, guaranteeing that all instances required for such a ProvisioningRequest
// are provisioned atomically.
func (u *upCloudNodeGroup) AtomicIncreaseSize(_ int) error {
return cloudprovider.ErrNotImplemented
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,10 @@ func TestUpCloudNodeGroup_TemplateNodeInfo(t *testing.T) {
_, err := g.TemplateNodeInfo()
require.ErrorIs(t, err, cloudprovider.ErrNotImplemented)
}

func TestUpCloudNodeGroup_AtomicIncreaseSize(t *testing.T) {
t.Parallel()

g := &upCloudNodeGroup{}
require.ErrorIs(t, g.AtomicIncreaseSize(1), cloudprovider.ErrNotImplemented)
}

0 comments on commit f39f057

Please sign in to comment.