1 Star 0 Fork 0

golang/rke

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cloudprovider.go 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
Sebastiaan 提交于 2019-02-12 00:21 . Add AWS cloudprovider config
package cloudprovider
import (
"github.com/rancher/rke/cloudprovider/aws"
"github.com/rancher/rke/cloudprovider/azure"
"github.com/rancher/rke/cloudprovider/custom"
"github.com/rancher/rke/cloudprovider/openstack"
"github.com/rancher/rke/cloudprovider/vsphere"
"github.com/rancher/types/apis/management.cattle.io/v3"
)
type CloudProvider interface {
Init(cloudProviderConfig v3.CloudProvider) error
GenerateCloudConfigFile() (string, error)
GetName() string
}
func InitCloudProvider(cloudProviderConfig v3.CloudProvider) (CloudProvider, error) {
var p CloudProvider
if cloudProviderConfig.AWSCloudProvider != nil || cloudProviderConfig.Name == aws.AWSCloudProviderName {
p = aws.GetInstance()
}
if cloudProviderConfig.AzureCloudProvider != nil || cloudProviderConfig.Name == azure.AzureCloudProviderName {
p = azure.GetInstance()
}
if cloudProviderConfig.OpenstackCloudProvider != nil || cloudProviderConfig.Name == openstack.OpenstackCloudProviderName {
p = openstack.GetInstance()
}
if cloudProviderConfig.VsphereCloudProvider != nil || cloudProviderConfig.Name == vsphere.VsphereCloudProviderName {
p = vsphere.GetInstance()
}
if cloudProviderConfig.CustomCloudProvider != "" {
p = custom.GetInstance()
}
if p != nil {
if err := p.Init(cloudProviderConfig); err != nil {
return nil, err
}
}
return p, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gober/rke.git
git@gitee.com:gober/rke.git
gober
rke
rke
v0.2.2

搜索帮助