cloudprovider

package
v1.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloudClusterCreatorLabelKey labels the creator of cloud cluster
	CloudClusterCreatorLabelKey = "api.core.oam.dev/cloud-cluster-creator"
)
View Source
const (
	// ProviderAliyun cloud provider aliyun
	ProviderAliyun = "aliyun"
)

Variables

This section is empty.

Functions

func GetCloudClusterFullName

func GetCloudClusterFullName(provider string, clusterName string) string

GetCloudClusterFullName construct the full name of cloud cluster which will be used as the name of terraform configuration

Types

type AliyunCloudProvider

type AliyunCloudProvider struct {
	*cs20151215.Client
	// contains filtered or unexported fields
}

AliyunCloudProvider describes the cloud provider in aliyun

func NewAliyunCloudProvider

func NewAliyunCloudProvider(accessKeyID string, accessKeySecret string, k8sClient client.Client) (*AliyunCloudProvider, error)

NewAliyunCloudProvider create aliyun cloud provider

func (*AliyunCloudProvider) CreateCloudCluster

func (provider *AliyunCloudProvider) CreateCloudCluster(ctx context.Context, clusterName string, zone string, worker int, cpu int64, mem int64) (string, error)

CreateCloudCluster create cloud cluster

func (*AliyunCloudProvider) GetClusterInfo

func (provider *AliyunCloudProvider) GetClusterInfo(clusterID string) (*CloudCluster, error)

GetClusterInfo retrieves cluster info by clusterID

func (*AliyunCloudProvider) GetClusterKubeConfig

func (provider *AliyunCloudProvider) GetClusterKubeConfig(clusterID string) (string, error)

GetClusterKubeConfig get cluster kubeconfig by clusterID

func (*AliyunCloudProvider) IsInvalidKey

func (provider *AliyunCloudProvider) IsInvalidKey(err error) bool

IsInvalidKey check if error is InvalidAccessKey or InvalidSecretKey

func (*AliyunCloudProvider) ListCloudClusters

func (provider *AliyunCloudProvider) ListCloudClusters(pageNumber int, pageSize int) ([]*CloudCluster, int, error)

ListCloudClusters list clusters with page info, return clusters, total count and error

type CloudCluster

type CloudCluster struct {
	Provider     string            `json:"provider"`
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Type         string            `json:"type"`
	Zone         string            `json:"zone"`
	ZoneID       string            `json:"zoneID"`
	RegionID     string            `json:"regionID"`
	VpcID        string            `json:"vpcID"`
	Labels       map[string]string `json:"labels"`
	Status       string            `json:"status"`
	APIServerURL string            `json:"apiServerURL"`
	DashBoardURL string            `json:"dashboardURL"`
}

CloudCluster describes the interface that cloud provider should return

type CloudClusterProvider

type CloudClusterProvider interface {
	IsInvalidKey(err error) bool
	ListCloudClusters(pageNumber int, pageSize int) ([]*CloudCluster, int, error)
	GetClusterKubeConfig(clusterID string) (string, error)
	GetClusterInfo(clusterID string) (*CloudCluster, error)
	CreateCloudCluster(ctx context.Context, clusterName string, zone string, worker int, cpu int64, mem int64) (string, error)
}

CloudClusterProvider abstracts the cloud provider to provide cluster access

func GetClusterProvider

func GetClusterProvider(provider string, accessKeyID string, accessKeySecret string, k8sClient client.Client) (CloudClusterProvider, error)

GetClusterProvider creates interface for getting cloud cluster provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL