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

Add cluster-api based cloudprovider #1866

Merged
merged 10 commits into from
Mar 12, 2020
6 changes: 5 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_all.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean
// +build !gce,!aws,!azure,!kubemark,!alicloud,!magnum,!digitalocean,!clusterapi

/*
Copyright 2018 The Kubernetes Authors.
@@ -24,6 +24,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/azure"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/baiducloud"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/clusterapi"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/digitalocean"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/gce"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/magnum"
@@ -40,6 +41,7 @@ var AvailableCloudProviders = []string{
cloudprovider.BaiducloudProviderName,
cloudprovider.MagnumProviderName,
cloudprovider.DigitalOceanProviderName,
clusterapi.ProviderName,
}

// DefaultCloudProvider is GCE.
@@ -63,6 +65,8 @@ func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGro
return magnum.BuildMagnum(opts, do, rl)
case packet.ProviderName:
return packet.BuildPacket(opts, do, rl)
case clusterapi.ProviderName:
return clusterapi.BuildClusterAPI(opts, do, rl)
}
return nil
}
42 changes: 42 additions & 0 deletions cluster-autoscaler/cloudprovider/builder/builder_clusterapi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// +build clusterapi

/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package builder

import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/clusterapi"
"k8s.io/autoscaler/cluster-autoscaler/config"
)

// AvailableCloudProviders supported by the cloud provider builder.
var AvailableCloudProviders = []string{
clusterapi.ProviderName,
}

// DefaultCloudProvider for machineapi-only build.
const DefaultCloudProvider = clusterapi.ProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case clusterapi.ProviderName:
return clusterapi.BuildClusterAPI(opts, do, rl)
}

return nil
}
14 changes: 14 additions & 0 deletions cluster-autoscaler/cloudprovider/clusterapi/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
approvers:
frobware marked this conversation as resolved.
Show resolved Hide resolved
- frobware
- enxebre
- elmiko
- hardikdr
- detiber
- ncdc
reviewers:
- frobware
- enxebre
- elmiko
- hardikdr
- detiber
- ncdc
Loading