kubermatic / machine-controller

Apache License 2.0
306 stars 125 forks source link

Scaling from/to 0 capabilities #1618

Open dcardellino opened 1 year ago

dcardellino commented 1 year ago

Cluster Autoscaler added support for "Scaling from/to 0". Talking with @xmudrii I open this issue to verify if this is feasible.

https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/cloudprovider/clusterapi#scale-from-zero-support

acbox commented 1 year ago

This would be a great feature to reduce the cost of cloud development environments, by scaling down to 0 outside of business hours.

Skarlso commented 7 months ago

As far as I understand it, isn't it just that we need to add Capacity in the machine status:

        // Capacity defines the resource capacity for this machine.
    // This value is used for autoscaling from zero operations as defined in:
    // https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
    // +optional
    Capacity corev1.ResourceList `json:"capacity,omitempty"`

And the rest can be taken care of by the cluster autoscaler once certain annotations are provided.

Skarlso commented 7 months ago

Here is an example on how to apply and use it with CAPA which is using CAPI: https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3684