代码拉取完成,页面将自动刷新
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.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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。