Skip to content

Commit 4f30519

Browse files
authored
Add CoreWeave Cluster Autoscaler provider (#8332)
* initial commit * Add coreweave manager and node pools using unstructure Add provider unit tests coverage = 68.7% run go fmt update comments on coreweave files change const to unexported Add boilerplate header Remove unused function from manager Add coreave tag exclusion from the build_all * address comments and feedbacks * use the shared *rest.Config from the autoscaler's logic * update the comments for clouProvider in charts values file * update charts README with coreweave cloudProvider
1 parent 126b76d commit 4f30519

20 files changed

+1850
-5
lines changed

charts/cluster-autoscaler/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ name: cluster-autoscaler
1111
sources:
1212
- https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
1313
type: application
14-
version: 9.49.0
14+
version: 9.50.0

charts/cluster-autoscaler/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ vpa:
454454
| civoClusterID | string | `""` | Cluster ID for the Civo cluster. Required if `cloudProvider=civo` |
455455
| civoRegion | string | `""` | Region for the Civo cluster. Required if `cloudProvider=civo` |
456456
| cloudConfigPath | string | `""` | Configuration file for cloud provider. |
457-
| cloudProvider | string | `"aws"` | The cloud provider where the autoscaler runs. Currently only `gce`, `aws`, `azure`, `magnum`, `clusterapi` and `civo` are supported. `aws` supported for AWS. `gce` for GCE. `azure` for Azure AKS. `magnum` for OpenStack Magnum, `clusterapi` for Cluster API. `civo` for Civo Cloud. |
457+
| cloudProvider | string | `"aws"` | The cloud provider where the autoscaler runs. Currently only `gce`, `aws`, `azure`, `magnum`, `clusterapi`, `civo` and `coreweave` are supported. `aws` supported for AWS. `gce` for GCE. `azure` for Azure AKS. `magnum` for OpenStack Magnum, `clusterapi` for Cluster API. `civo` for Civo Cloud. `coreweave` for CoreWeave. |
458458
| clusterAPICloudConfigPath | string | `"/etc/kubernetes/mgmt-kubeconfig"` | Path to kubeconfig for connecting to Cluster API Management Cluster, only used if `clusterAPIMode=kubeconfig-kubeconfig or incluster-kubeconfig` |
459459
| clusterAPIConfigMapsNamespace | string | `""` | Namespace on the workload cluster to store Leader election and status configmaps |
460460
| clusterAPIKubeconfigSecret | string | `""` | Secret containing kubeconfig for connecting to Cluster API managed workloadcluster Required if `cloudProvider=clusterapi` and `clusterAPIMode=kubeconfig-kubeconfig,kubeconfig-incluster or incluster-kubeconfig` |

charts/cluster-autoscaler/templates/clusterrole.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ metadata:
66
{{ include "cluster-autoscaler.labels" . | indent 4 }}
77
name: {{ template "cluster-autoscaler.fullname" . }}
88
rules:
9+
{{- if (eq .Values.cloudProvider "coreweave") }}
10+
- apiGroups:
11+
- "compute.coreweave.com"
12+
resources:
13+
- nodepools
14+
verbs:
15+
- get
16+
- list
17+
- patch
18+
- update
19+
{{- end }}
920
- apiGroups:
1021
- ""
1122
resources:

charts/cluster-autoscaler/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ civoRegion: ""
133133
cloudConfigPath: ""
134134

135135
# cloudProvider -- The cloud provider where the autoscaler runs.
136-
# Currently only `gce`, `aws`, `azure`, `magnum`, `clusterapi` and `civo` are supported.
136+
# Currently only `gce`, `aws`, `azure`, `magnum`, `clusterapi`, `civo` and `coreweave` are supported.
137137
# `aws` supported for AWS. `gce` for GCE. `azure` for Azure AKS.
138138
# `magnum` for OpenStack Magnum, `clusterapi` for Cluster API.
139139
# `civo` for Civo Cloud.
140+
# `coreweave` for CoreWeave.
140141
cloudProvider: aws
141142

142143
# clusterAPICloudConfigPath -- Path to kubeconfig for connecting to Cluster API Management Cluster, only used if `clusterAPIMode=kubeconfig-kubeconfig or incluster-kubeconfig`

cluster-autoscaler/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ You should also take a look at the notes and "gotchas" for your specific cloud p
2323
* [Civo](./cloudprovider/civo/README.md)
2424
* [CloudStack](./cloudprovider/cloudstack/README.md)
2525
* [ClusterAPI](./cloudprovider/clusterapi/README.md)
26+
* [CoreWeave](./cloudprovider/coreweave/README.md)
2627
* [DigitalOcean](./cloudprovider/digitalocean/README.md)
2728
* [Exoscale](./cloudprovider/exoscale/README.md)
2829
* [Equinix Metal](cloudprovider/equinixmetal/README.md#notes)

cluster-autoscaler/cloudprovider/builder/builder_all.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !gce && !aws && !azure && !kubemark && !alicloud && !magnum && !digitalocean && !clusterapi && !huaweicloud && !ionoscloud && !linode && !hetzner && !bizflycloud && !brightbox && !equinixmetal && !oci && !vultr && !tencentcloud && !scaleway && !externalgrpc && !civo && !rancher && !volcengine && !baiducloud && !cherry && !cloudstack && !exoscale && !kamatera && !ovhcloud && !kwok && !utho
2-
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud,!ionoscloud,!linode,!hetzner,!bizflycloud,!brightbox,!equinixmetal,!oci,!vultr,!tencentcloud,!scaleway,!externalgrpc,!civo,!rancher,!volcengine,!baiducloud,!cherry,!cloudstack,!exoscale,!kamatera,!ovhcloud,!kwok,!utho
1+
//go:build !gce && !aws && !azure && !kubemark && !alicloud && !magnum && !digitalocean && !clusterapi && !huaweicloud && !ionoscloud && !linode && !hetzner && !bizflycloud && !brightbox && !equinixmetal && !oci && !vultr && !tencentcloud && !scaleway && !externalgrpc && !civo && !rancher && !volcengine && !baiducloud && !cherry && !cloudstack && !exoscale && !kamatera && !ovhcloud && !kwok && !utho && !coreweave
2+
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi,!huaweicloud,!ionoscloud,!linode,!hetzner,!bizflycloud,!brightbox,!equinixmetal,!oci,!vultr,!tencentcloud,!scaleway,!externalgrpc,!civo,!rancher,!volcengine,!baiducloud,!cherry,!cloudstack,!exoscale,!kamatera,!ovhcloud,!kwok,!utho,!coreweave
33

44
/*
55
Copyright 2018 The Kubernetes Authors.
@@ -31,6 +31,7 @@ import (
3131
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/civo"
3232
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/cloudstack"
3333
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/clusterapi"
34+
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/coreweave"
3435
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/digitalocean"
3536
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/equinixmetal"
3637
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/exoscale"
@@ -87,6 +88,7 @@ var AvailableCloudProviders = []string{
8788
cloudprovider.RancherProviderName,
8889
cloudprovider.VolcengineProviderName,
8990
cloudprovider.UthoProviderName,
91+
cloudprovider.CoreWeaveProviderName,
9092
}
9193

9294
// DefaultCloudProvider is GCE.
@@ -157,6 +159,8 @@ func buildCloudProvider(opts config.AutoscalingOptions,
157159
return volcengine.BuildVolcengine(opts, do, rl)
158160
case cloudprovider.UthoProviderName:
159161
return utho.BuildUtho(opts, do, rl)
162+
case cloudprovider.CoreWeaveProviderName:
163+
return coreweave.BuildCoreWeave(opts, do, rl)
160164
}
161165
return nil
162166
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//go:build coreweave
2+
// +build coreweave
3+
4+
/*
5+
Copyright 2025 The Kubernetes Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
20+
package builder
21+
22+
import (
23+
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
24+
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/coreweave"
25+
"k8s.io/autoscaler/cluster-autoscaler/config"
26+
"k8s.io/client-go/informers"
27+
)
28+
29+
// AvailableCloudProviders supported by the cloud provider builder.
30+
var AvailableCloudProviders = []string{
31+
cloudprovider.CoreWeaveProviderName,
32+
}
33+
34+
// DefaultCloudProvider for coreweave-only build is coreweave.
35+
const DefaultCloudProvider = cloudprovider.CoreWeaveProviderName
36+
37+
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
38+
return coreweave.BuildCoreWeave(opts, do, rl)
39+
}

cluster-autoscaler/cloudprovider/cloud_provider.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const (
4444
CherryServersProviderName = "cherryservers"
4545
// CloudStackProviderName gets the provider name of cloudstack
4646
CloudStackProviderName = "cloudstack"
47+
// CoreWeaveProviderName gets the provider name of coreweave
48+
CoreWeaveProviderName = "coreweave"
4749
// ClusterAPIProviderName gets the provider name of clusterapi
4850
ClusterAPIProviderName = "clusterapi"
4951
// DigitalOceanProviderName gets the provider name of digitalocean
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
maintainers:
2+
- keedya
3+
- ddymko
4+
5+
6+
labels:
7+
- area/provider/coreweave
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Cluster Autoscaler for CoreWeave
2+
3+
The Cluster Autoscaler for CoreWeave automatically adjusts the size of your Kubernetes cluster by adding or removing nodes in CoreWeave NodePools based on pending workloads and resource utilization.
4+
5+
## Configuration
6+
7+
### Cloud config
8+
9+
The CoreWeave provider does not require a separate cloud config file. All configuration is managed via Kubernetes CoreWeave NodePool resource and standard Cluster Autoscaler flags.
10+
11+
## Behavior
12+
13+
- The autoscaler monitors unschedulable pods and scales NodePools up or down as needed.
14+
- Minimum and maximum NodePools sizes are configured via the CoreWeave NodePool custom resources.
15+
16+
## Development
17+
18+
To build and test the CoreWeave provider
19+
20+
1. **Build the `cluster-autoscaler` binary:**
21+
```sh
22+
make build-in-docker
23+
```
24+
25+
To build and test the CoreWeave provider in k8s:
26+
27+
1. **Build the `cluster-autoscaler` docker image:**
28+
```sh
29+
REGISTRY=gcr.io/k8s-staging-autoscaling TAG=dev make make-image
30+
```
31+
32+
2. **Push the Docker image to your registry:**
33+
```sh
34+
REGISTRY=gcr.io/k8s-staging-autoscaling TAG=dev make push-image
35+
```
36+
37+
## Usage
38+
39+
To enable the CoreWeave provider, set the following flag when running the autoscaler:
40+
41+
```sh
42+
./cluster-autoscaler --cloud-provider=coreweave
43+
```
44+
## Usage with Helm Charts
45+
46+
When deploying the Cluster Autoscaler for CoreWeave using the provided Helm chart, you can customize its behavior using the `extraArgs` section in your `values.yaml` file.
47+
These arguments are passed directly to the Cluster Autoscaler container.
48+
49+
## Helm Chart Deployment
50+
51+
You can deploy the Cluster Autoscaler for CoreWeave using the official Helm chart.
52+
Below are the basic steps:
53+
54+
1. **Add the Helm repository (if not already added):**
55+
```sh
56+
helm repo add autoscaler https://kubernetes.github.io/autoscaler
57+
helm repo update
58+
```
59+
60+
2. **Customize your `values.yaml`:** (Replace image.repository and image.tag below with your registry and the tag you chose)
61+
- Set `cloudProvider: coreweave`
62+
- Set `autoDiscovery.clusterName: cluster.local`
63+
- Set `image.tag: dev`
64+
- Set `image.repository: gcr.io/k8s-staging-autoscaling/cluster-autoscaler-arm64`
65+
- Set any desired `extraArgs` as shown [parameters](../../FAQ.md#what-are-the-parameters-to-ca)
66+
- Optionally adjust resources, tolerations, nodeSelector, etc.
67+
68+
3. **Install or upgrade the chart:**
69+
```sh
70+
helm upgrade --install cluster-autoscaler autoscaler/cluster-autoscaler \
71+
--namespace kube-system \
72+
-f values.yaml
73+
```
74+
75+
4. **Verify deployment:**
76+
```sh
77+
kubectl -n kube-system get pods -l app.kubernetes.io/name=coreweave-cluster-autoscaler
78+
```
79+
80+
For more advanced configuration, refer to the [values.yaml](../../../charts/cluster-autoscaler/values.yaml) in this repository.
81+
82+
83+
## Contributing
84+
85+
Contributions are welcome! Please open issues or pull requests for bug fixes, improvements, or new features.
86+
87+
## License
88+
89+
This project is licensed under the Apache 2.0 License.

0 commit comments

Comments
 (0)