v2

package
v0.9.130 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	URI_PREFIX = bce.URI_PREFIX + "api/cce/service/v2"

	DEFAULT_ENDPOINT = "cce." + bce.DEFAULT_REGION + ".baidubce.com"

	REQUEST_CLUSTER_URL = "/cluster"

	REQUEST_CLUSTER_LIST_URL = "/clusters"

	REQUEST_INSTANCE_URL = "/instance"

	REQUEST_INSTANCE_LIST_URL = "/instances"

	REQUEST_INSTANCEGROUP_URL = "/instancegroup"

	REQUEST_INSTANCEGROUP_LIST_URL = "/instancegroups"

	REQUEST_INSTANCEGROUP_AUTOSCALER_URL = "/autoscaler"

	REQUEST_INSTANCEGROUP_REPLICAS_URL = "/replicas"

	REQUEST_INSTANCEGROUP_SCALE_UP_URL = "/scaleup"

	REQUEST_INSTANCEGROUP_SCALE_DOWN_URL = "/scaledown"

	REQUEST_QUOTA_URL = "/quota"

	REQUEST_NODE_URL = "/node"

	REQUEST_NET_URL = "/net"

	REQUEST_NET_CHECK_CONTAINER_NETWORK_CIDR_URL = "/check_container_network_cidr"

	REQUEST_NET_CHECK_CLUSTERIP_CIDR_URL = "/check_clusterip_cidr"

	REQUEST_NET_RECOMMEND_CLSUTERIP_CIDR_URL = "/recommend_clusterip_cidr"

	REQUEST_NET_RECOMMEND_CONTAINER_CIDR_URL = "/recommend_container_cidr"

	REQUEST_AUTOSCALER = "/autoscaler"

	REQUEST_KUBECONFIG = "/kubeconfig/%s/%s"

	REQUEST_TASK_URL = "/task"

	REQUEST_TASK_LIST_URL = "/tasks"
)
View Source
const (
	// PageNoDefault 分页查询默认页码
	PageNoDefault int = 1
	// PageSizeDefault 分页查询默认页面元素数目
	PageSizeDefault int = 10
)
View Source
const (
	// MaxClusterIPServiceNum 集群最大的 ClusterIP Service 数量
	MaxClusterIPServiceNum = 65536
)

Variables

This section is empty.

Functions

func CheckKubeConfigType added in v0.9.25

func CheckKubeConfigType(kubeConfigType string) error

Types

type Autoscaler added in v0.9.20

type Autoscaler struct {
	ClusterID   string                  `json:"clusterID"`
	ClusterName string                  `json:"clusterName"`
	CAConfig    ClusterAutoscalerConfig `json:"caConfig,omitempty"`
}

type BLB

type BLB struct {
	ID    string `json:"id"`
	VPCIP string `json:"vpcIP"`
	EIP   string `json:"eip"`
}

BLB 定义 BLB 类型

type CheckClusterIPCIDRArgs

type CheckClusterIPCIDRArgs struct {
	VPCID             string                       `json:"vpcID"`
	VPCCIDR           string                       `json:"vpcCIDR"`
	VPCCIDRIPv6       string                       `json:"vpcCIDRIPv6"`
	ClusterIPCIDR     string                       `json:"clusterIPCIDR"`
	ClusterIPCIDRIPv6 string                       `json:"clusterIPCIDRIPv6"`
	IPVersion         types.ContainerNetworkIPType `json:"ipVersion"` // if not set, set ipv4
}

CheckClusterIPCIDRequest - 检查 ClusterIP CIDR 请求

type CheckClusterIPCIDRResponse

type CheckClusterIPCIDRResponse struct {
	IsConflict bool   `json:"isConflict"`
	ErrMsg     string `json:"errMsg"`
	RequestID  string `json:"requestID"`
}

CheckClusterIPCIDRResponse - 检查 ClusterIP CIDR 返回

type CheckContainerNetworkCIDRArgs

type CheckContainerNetworkCIDRArgs struct {
	VPCID             string                       `json:"vpcID"`
	VPCCIDR           string                       `json:"vpcCIDR"`
	VPCCIDRIPv6       string                       `json:"vpcCIDRIPv6"`
	ContainerCIDR     string                       `json:"containerCIDR"`
	ContainerCIDRIPv6 string                       `json:"containerCIDRIPv6"`
	ClusterIPCIDR     string                       `json:"clusterIPCIDR"`
	ClusterIPCIDRIPv6 string                       `json:"clusterIPCIDRIPv6"`
	MaxPodsPerNode    int                          `json:"maxPodsPerNode"`
	IPVersion         types.ContainerNetworkIPType `json:"ipVersion"` // if not set, set ipv4
}

CheckContainerNetworkCIDRRequest 包含检查容器网络网段冲突的请求参数

type CheckContainerNetworkCIDRResponse

type CheckContainerNetworkCIDRResponse struct {
	MaxNodeNum int `json:"maxNodeNum"`
	NetworkConflictInfo
	RequestID string `json:"requestID"`
}

CheckContainerNetworkCIDRResponse 检查容器网络网段冲突的响应

type CleanPolicy added in v0.9.20

type CleanPolicy string

type Client

type Client struct {
	*bce.BceClient
}

Client 实现 ccev2.Interface

func NewClient

func NewClient(ak, sk, endPoint string) (*Client, error)

func (*Client) CheckClusterIPCIDR

func (c *Client) CheckClusterIPCIDR(args *CheckClusterIPCIDRArgs) (*CheckClusterIPCIDRResponse, error)

检查集群网络网段

func (*Client) CheckContainerNetworkCIDR

func (c *Client) CheckContainerNetworkCIDR(args *CheckContainerNetworkCIDRArgs) (*CheckContainerNetworkCIDRResponse, error)

检查容器网络网段

func (*Client) CreateAutoscaler added in v0.9.25

func (c *Client) CreateAutoscaler(args *CreateAutoscalerArgs) (*CreateAutoscalerResponse, error)

创建autoscaler配置

func (*Client) CreateCluster

func (c *Client) CreateCluster(args *CreateClusterArgs) (*CreateClusterResponse, error)

创建集群

func (*Client) CreateInstanceGroup added in v0.9.20

func (c *Client) CreateInstanceGroup(args *CreateInstanceGroupArgs) (*CreateInstanceGroupResponse, error)

创建节点组

func (*Client) CreateInstances

func (c *Client) CreateInstances(args *CreateInstancesArgs) (*CreateInstancesResponse, error)

创建节点(扩容)

func (*Client) CreateScaleDownInstanceGroupTask added in v0.9.76

func (c *Client) CreateScaleDownInstanceGroupTask(args *CreateScaleDownInstanceGroupTaskArgs) (*CreateTaskResp, error)

创建节点组缩容任务

func (*Client) CreateScaleUpInstanceGroupTask added in v0.9.76

func (c *Client) CreateScaleUpInstanceGroupTask(args *CreateScaleUpInstanceGroupTaskArgs) (*CreateTaskResp, error)

创建节点组扩容任务

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(args *DeleteClusterArgs) (*DeleteClusterResponse, error)

删除集群

func (*Client) DeleteInstanceGroup added in v0.9.20

func (c *Client) DeleteInstanceGroup(args *DeleteInstanceGroupArgs) (*DeleteInstanceGroupResponse, error)

删除节点组

func (*Client) DeleteInstances

func (c *Client) DeleteInstances(args *DeleteInstancesArgs) (*DeleteInstancesResponse, error)

删除节点(缩容)

func (*Client) GetAutoscaler added in v0.9.25

func (c *Client) GetAutoscaler(args *GetAutoscalerArgs) (*GetAutoscalerResponse, error)

查询autoscaler配置

func (*Client) GetCluster

func (c *Client) GetCluster(clusterID string) (*GetClusterResponse, error)

获得集群详情

func (*Client) GetClusterCRD added in v0.9.107

func (c *Client) GetClusterCRD(args *GetClusterCRDArgs) (*GetClusterCRDResponse, error)

func (*Client) GetClusterNodeQuota

func (c *Client) GetClusterNodeQuota(clusterID string) (*GetQuotaResponse, error)

用户集群 Node Quota

func (*Client) GetClusterQuota

func (c *Client) GetClusterQuota() (*GetQuotaResponse, error)

用户集群 Quota

func (*Client) GetInstance

func (c *Client) GetInstance(args *GetInstanceArgs) (*GetInstanceResponse, error)

查询节点

func (*Client) GetInstanceCRD added in v0.9.103

func (c *Client) GetInstanceCRD(args *GetInstanceCRDArgs) (*GetInstanceCRDResponse, error)

func (*Client) GetInstanceGroup added in v0.9.20

func (c *Client) GetInstanceGroup(args *GetInstanceGroupArgs) (*GetInstanceGroupResponse, error)

获取节点组详情

func (*Client) GetKubeConfig added in v0.9.25

func (c *Client) GetKubeConfig(args *GetKubeConfigArgs) (*GetKubeConfigResponse, error)

获取kubeconfig

func (*Client) GetTask added in v0.9.76

func (c *Client) GetTask(args *GetTaskArgs) (*GetTaskResp, error)

获取任务信息

func (*Client) ListClusters

func (c *Client) ListClusters(args *ListClustersArgs) (*ListClustersResponse, error)

集群列表

func (*Client) ListInstanceGroups added in v0.9.20

func (c *Client) ListInstanceGroups(args *ListInstanceGroupsArgs) (*ListInstanceGroupResponse, error)

获取节点组列表

func (*Client) ListInstancesByInstanceGroupID added in v0.9.20

func (c *Client) ListInstancesByInstanceGroupID(args *ListInstanceByInstanceGroupIDArgs) (*ListInstancesByInstanceGroupIDResponse, error)

获取节点组的节点列表

func (*Client) ListInstancesByPage

func (c *Client) ListInstancesByPage(args *ListInstancesByPageArgs) (*ListInstancesResponse, error)

集群内节点列表

func (*Client) ListTasks added in v0.9.76

func (c *Client) ListTasks(args *ListTasksArgs) (*ListTaskResp, error)

获取任务列表

func (*Client) RecommendClusterIPCIDR

func (c *Client) RecommendClusterIPCIDR(args *RecommendClusterIPCIDRArgs) (*RecommendClusterIPCIDRResponse, error)

推荐集群CIDR

func (*Client) RecommendContainerCIDR

func (c *Client) RecommendContainerCIDR(args *RecommendContainerCIDRArgs) (*RecommendContainerCIDRResponse, error)

推荐容器CIDR

func (*Client) UpdateAutoscaler added in v0.9.25

func (c *Client) UpdateAutoscaler(args *UpdateAutoscalerArgs) (*UpdateAutoscalerResponse, error)

更新autoscaler配置

func (*Client) UpdateClusterCRD added in v0.9.107

func (c *Client) UpdateClusterCRD(args *UpdateClusterCRDArgs) (*CommonResponse, error)

func (*Client) UpdateInstance added in v0.9.25

func (c *Client) UpdateInstance(args *UpdateInstanceArgs) (*UpdateInstancesResponse, error)

更新节点配置

func (*Client) UpdateInstanceCRD added in v0.9.103

func (c *Client) UpdateInstanceCRD(args *UpdateInstanceCRDRequest) (*CommonResponse, error)

func (*Client) UpdateInstanceGroupClusterAutoscalerSpec added in v0.9.25

修改节点组节点Autoscaler配置

func (*Client) UpdateInstanceGroupReplicas added in v0.9.20

func (c *Client) UpdateInstanceGroupReplicas(args *UpdateInstanceGroupReplicasArgs) (*UpdateInstanceGroupReplicasResponse, error)

更新节点组副本数

type Cluster

type Cluster struct {
	Spec   *ClusterSpec   `json:"spec"`
	Status *ClusterStatus `json:"status"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

Cluster - Cluster 返回

type ClusterAutoscalerConfig added in v0.9.20

type ClusterAutoscalerConfig struct {
	KubeVersion    string                           `json:"kubeVersion,omitempty"`
	ReplicaCount   int                              `json:"replicaCount"`
	InstanceGroups []ClusterAutoscalerInstanceGroup `json:"instanceGroups,omitempty"`
	// default: false
	ScaleDownEnabled bool `json:"scaleDownEnabled"`
	// 可选,缩容阈值百分比,范围(0, 100)
	ScaleDownUtilizationThreshold *int `json:"scaleDownUtilizationThreshold,omitempty"`
	// 可选,GPU缩容阈值百分比,范围(0, 100)
	ScaleDownGPUUtilizationThreshold *int `json:"scaleDownGPUUtilizationThreshold,omitempty"`
	// 可选,缩容触发时延,单位:m
	ScaleDownUnneededTime *int `json:"scaleDownUnneededTime,omitempty"`
	// 可选,扩容后缩容启动时延,单位:m
	ScaleDownDelayAfterAdd *int `json:"scaleDownDelayAfterAdd,omitempty"`
	// 可选,最大并发缩容数
	MaxEmptyBulkDelete *int `json:"maxEmptyBulkDelete,omitempty"`
	// 可选,
	SkipNodesWithLocalStorage *bool `json:"skipNodesWithLocalStorage,omitempty"`
	// 可选,
	SkipNodesWithSystemPods *bool `json:"skipNodesWithSystemPods,omitempty"`
	// supported: random, most-pods, least-waste, priority; default: random
	Expander string `json:"expander"`
}

type ClusterAutoscalerInstanceGroup added in v0.9.20

type ClusterAutoscalerInstanceGroup struct {
	InstanceGroupID string
	MinReplicas     int
	MaxReplicas     int
	Priority        int
}

type ClusterAutoscalerSpec added in v0.9.20

type ClusterAutoscalerSpec struct {
	Enabled              bool `json:"enabled"`
	MinReplicas          int  `json:"minReplicas"`
	MaxReplicas          int  `json:"maxReplicas"`
	ScalingGroupPriority int  `json:"scalingGroupPriority"`
}

type ClusterCRD added in v0.9.107

type ClusterCRD struct {
	ObjectMeta `json:"metadata,omitempty"`

	Spec   types.ClusterSpec `json:"spec,omitempty"`
	Status ClusterStatus     `json:"status,omitempty"`
}

type ClusterIPCIDRConflict

type ClusterIPCIDRConflict struct {
	// NetworkConflictType 冲突类型,可取的值: ClusterIPCIDRAndNodeCIDRConflict、ClusterIPCIDRAndContainerCIDRConflict
	ConflictType NetworkConflictType `json:"conflictType"`
	// ConflictNodeCIDR 与 ClusterIP 网段冲突的节点网段,当且仅当 NetworkConflictType 为 ClusterIPCIDRAndNodeCIDRConflict 不为 nil
	ConflictNodeCIDR *ConflictNodeCIDR `json:"conflictNodeCIDR"`
	// ConflictContainerCIDR 与 ClusterIP 网段冲突的节点网段,当且仅当 NetworkConflictType 为 ClusterIPCIDRAndContainerCIDRConflict 不为 nil
	ConflictContainerCIDR *ConflictContainerCIDR `json:"conflictContainerCIDR"`
}

ClusterIPCIDRConflict ClusterIP 网段冲突信息

type ClusterKeywordType

type ClusterKeywordType string

ClusterKeywordType 集群模糊查询字段

const (
	// ClusterKeywordTypeClusterName 集群模糊查询字段: ClusterName
	ClusterKeywordTypeClusterName ClusterKeywordType = "clusterName"
	// ClusterKeywordTypeClusterID 集群模糊查询字段: ClusterID
	ClusterKeywordTypeClusterID ClusterKeywordType = "clusterID"
)

type ClusterOrderBy

type ClusterOrderBy string

ClusterOrderBy 集群查询排序字段

const (
	// ClusterOrderByClusterName 集群查询排序字段: ClusterName
	ClusterOrderByClusterName ClusterOrderBy = "clusterName"
	// ClusterOrderByClusterID 集群查询排序字段: ClusterID
	ClusterOrderByClusterID ClusterOrderBy = "clusterID"
	// ClusterOrderByCreatedAt 集群查询排序字段: CreatedAt
	ClusterOrderByCreatedAt ClusterOrderBy = "createdAt"
)

type ClusterPage

type ClusterPage struct {
	KeywordType ClusterKeywordType `json:"keywordType"`
	Keyword     string             `json:"keyword"`
	OrderBy     ClusterOrderBy     `json:"orderBy"`
	Order       Order              `json:"order"`
	PageNo      int                `json:"pageNo"`
	PageSize    int                `json:"pageSize"`
	TotalCount  int                `json:"totalCount"`
	ClusterList []*Cluster         `json:"clusterList"`
}

ClusterPage - 集群分页查询返回

type ClusterSpec

type ClusterSpec struct {
	ClusterID   string            `json:"clusterID"`
	ClusterName string            `json:"clusterName"`
	ClusterType types.ClusterType `json:"clusterType"`

	Description string `json:"description"`

	K8SVersion types.K8SVersion `json:"k8sVersion"`

	VPCID   string `json:"vpcID"`
	VPCCIDR string `json:"vpcCIDR"`

	Plugins []string `json:"plugins"`

	MasterConfig           types.MasterConfig           `json:"masterConfig"`
	ContainerNetworkConfig types.ContainerNetworkConfig `json:"containerNetworkConfig"`
}

作为返回值的ClusterSpec

type ClusterStatus

type ClusterStatus struct {
	ClusterBLB BLB `json:"clusterBLB"`

	ClusterPhase types.ClusterPhase `json:"clusterPhase"`

	NodeNum int `json:"nodeNum"`
}

ClusterStatus - Cluster Status

type CommonResponse

type CommonResponse struct {
	RequestID string `json:"requestID"`
}

type ConflictCluster

type ConflictCluster struct {
	ClusterID     string `json:"clusterID"`
	ContainerCIDR string `json:"containerCIDR"`
}

ConflictCluster 同一 VPC 内容器网段冲突的集群信息

type ConflictContainerCIDR

type ConflictContainerCIDR struct {
	ContainerCIDR string `json:"containerCIDR"`
}

ConflictContainerCIDR 容器网段冲突信息

type ConflictNodeCIDR

type ConflictNodeCIDR struct {
	NodeCIDR string `json:"nodeCIDR"`
}

ConflictNodeCIDR 节点网段冲突信息

type ConflictVPCRoute

type ConflictVPCRoute struct {
	RouteRule vpc.RouteRule `json:"routeRule"`
}

ConflictVPCRoute 冲突的 VPC 路由

type ContainerCIDRConflict

type ContainerCIDRConflict struct {
	// NetworkConflictType 冲突类型,可取的值: ContainerCIDRAndNodeCIDRConflict、ContainerCIDRAndExistedClusterContainerCIDRConflict、ContainerCIDRAndVPCRouteConflict
	ConflictType NetworkConflictType `json:"conflictType"`
	// ConflictNodeCIDR 与容器网段冲突的节点网段,当且仅当 NetworkConflictType 为 ContainerCIDRAndNodeCIDRConflict 不为 nil
	ConflictNodeCIDR *ConflictNodeCIDR `json:"conflictNodeCIDR"`
	// ConflictCluster 与容器网段冲突的VPC内集群,当且仅当 NetworkConflictType 为 ContainerCIDRAndExistedClusterContainerCIDRConflict 不为 nil
	ConflictCluster *ConflictCluster `json:"conflictCluster"`
	// ConflictVPCRoute 与容器网段冲突的VPC路由,当且仅当 NetworkConflictType 为 ContainerCIDRAndVPCRouteConflict 不为 nil
	ConflictVPCRoute *ConflictVPCRoute `json:"conflictVPCRoute"`
}

ContainerCIDRConflict 容器网段冲突信息

type CreateAutoscalerArgs added in v0.9.25

type CreateAutoscalerArgs struct {
	ClusterID string
}

type CreateAutoscalerResponse added in v0.9.25

type CreateAutoscalerResponse struct {
	CommonResponse
}

type CreateClusterArgs

type CreateClusterArgs struct {
	CreateClusterRequest *CreateClusterRequest
}

CreateCluterArgs为后续支持clientToken预留空间

type CreateClusterRequest

type CreateClusterRequest struct {
	ClusterSpec *types.ClusterSpec `json:"cluster"`
	MasterSpecs []*InstanceSet     `json:"masters,omitempty"`
	NodeSpecs   []*InstanceSet     `json:"nodes,omitempty"`
}

CreateClusterRequest - 创建 Cluster 参数

type CreateClusterResponse

type CreateClusterResponse struct {
	ClusterID string `json:"clusterID"`
	RequestID string `json:"requestID"`
}

CreateClusterResponse - 创建 Cluster 返回

type CreateInstanceGroupArgs added in v0.9.20

type CreateInstanceGroupArgs struct {
	ClusterID string
	Request   *CreateInstanceGroupRequest
}

type CreateInstanceGroupRequest added in v0.9.20

type CreateInstanceGroupRequest struct {
	types.InstanceGroupSpec
}

CreateInstanceGroupRequest - 创建InstanceGroup request

type CreateInstanceGroupResponse added in v0.9.20

type CreateInstanceGroupResponse struct {
	CommonResponse
	InstanceGroupID string `json:"instanceGroupID"`
}

CreateInstanceGroupResponse - 创建InstanceGroup response

type CreateInstancesArgs

type CreateInstancesArgs struct {
	ClusterID string
	Instances []*InstanceSet
}

type CreateInstancesResponse

type CreateInstancesResponse struct {
	CCEInstanceIDs []string `json:"cceInstanceIDs"`
	RequestID      string   `json:"requestID"`
}

CreateInstancesResponse - 创建 Instances 返回

type CreateScaleDownInstanceGroupTaskArgs added in v0.9.76

type CreateScaleDownInstanceGroupTaskArgs struct {
	ClusterID            string
	InstanceGroupID      string
	InstancesToBeRemoved []string
}

type CreateScaleUpInstanceGroupTaskArgs added in v0.9.76

type CreateScaleUpInstanceGroupTaskArgs struct {
	ClusterID       string
	InstanceGroupID string
	TargetReplicas  int
}

type CreateTaskResp added in v0.9.76

type CreateTaskResp struct {
	CommonResponse
	TaskID string `json:"taskID"`
}

type DeleteClusterArgs

type DeleteClusterArgs struct {
	ClusterID         string
	DeleteResource    bool
	DeleteCDSSnapshot bool
}

type DeleteClusterResponse

type DeleteClusterResponse struct {
	RequestID string `json:"requestID"`
}

DeleteClusterResponse - 删除 Cluster 返回

type DeleteInstanceGroupArgs added in v0.9.20

type DeleteInstanceGroupArgs struct {
	ClusterID       string
	InstanceGroupID string
	DeleteInstances bool
}

type DeleteInstanceGroupResponse added in v0.9.20

type DeleteInstanceGroupResponse struct {
	CommonResponse
}

type DeleteInstancesArgs

type DeleteInstancesArgs struct {
	ClusterID              string
	DeleteInstancesRequest *DeleteInstancesRequest
}

type DeleteInstancesRequest

type DeleteInstancesRequest struct {
	InstanceIDs  []string            `json:"instanceIDs,omitempty"`
	DeleteOption *types.DeleteOption `json:"deleteOption,omitempty"`
}

DeleteInstancesRequest - 删除节点请求

type DeleteInstancesResponse

type DeleteInstancesResponse struct {
	RequestID string `json:"requestID"`
}

DeleteInstancesResponse - 删除 Instances 返回

type GetAutoscalerArgs added in v0.9.25

type GetAutoscalerArgs struct {
	ClusterID string
}

type GetAutoscalerResponse added in v0.9.20

type GetAutoscalerResponse struct {
	Autoscaler *Autoscaler `json:"autoscaler"`
	RequestID  string      `json:"requestID"`
}

type GetClusterCRDArgs added in v0.9.107

type GetClusterCRDArgs struct {
	ClusterID string `json:"clusterID"`
}

type GetClusterCRDResponse added in v0.9.107

type GetClusterCRDResponse struct {
	Cluster   *ClusterCRD `json:"cluster"`
	RequestID string      `json:"requestID"`
}

type GetClusterResponse

type GetClusterResponse struct {
	Cluster   *Cluster `json:"cluster"`
	RequestID string   `json:"requestID"`
}

GetClusterResponse - 查询 Cluster 返回

type GetInstanceArgs

type GetInstanceArgs struct {
	ClusterID  string
	InstanceID string
}

type GetInstanceCRDArgs added in v0.9.103

type GetInstanceCRDArgs struct {
	ClusterID string
	// cceInstanceID , cce 节点的唯一标志,不是底层机器的instanceID
	CCEInstanceID string
}

type GetInstanceCRDResponse added in v0.9.103

type GetInstanceCRDResponse struct {
	Instance  *InstanceCRD `json:"instance"`
	RequestID string       `json:"requestID"`
}

type GetInstanceGroupArgs added in v0.9.20

type GetInstanceGroupArgs struct {
	ClusterID       string
	InstanceGroupID string
}

type GetInstanceGroupResponse added in v0.9.20

type GetInstanceGroupResponse struct {
	CommonResponse
	InstanceGroup *InstanceGroup `json:"instanceGroup"`
}

type GetInstanceResponse

type GetInstanceResponse struct {
	Instance  *Instance `json:"instance"`
	RequestID string    `json:"requestID"`
}

GetInstanceResponse - 查询 Instances 返回

type GetKubeConfigArgs added in v0.9.25

type GetKubeConfigArgs struct {
	ClusterID      string
	KubeConfigType KubeConfigType
}

type GetKubeConfigResponse added in v0.9.25

type GetKubeConfigResponse struct {
	KubeConfigType KubeConfigType `json:"kubeConfigType"`
	KubeConfig     string         `json:"kubeConfig"`
	RequestID      string         `json:"requestID"`
}

GetKubeConfigResponse - 查询 KubeConfig 返回

type GetQuotaResponse

type GetQuotaResponse struct {
	types.Quota
	RequestID string `json:"requestID"`
}

GetQuotaResponse - 查询 Quota 返回

type GetTaskArgs added in v0.9.76

type GetTaskArgs struct {
	TaskType types.TaskType
	TaskID   string
}

type GetTaskResp added in v0.9.76

type GetTaskResp struct {
	CommonResponse
	Task *types.Task `json:"task"`
}

type Instance

type Instance struct {
	Spec   *types.InstanceSpec `json:"spec"`
	Status *InstanceStatus     `json:"status"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

Instance - 节点详情 作为sdk返回结果的Instance

type InstanceCRD added in v0.9.103

type InstanceCRD struct {
	ObjectMeta `json:"metadata,omitempty"`

	Spec   types.InstanceSpec `json:"spec,omitempty"`
	Status InstanceStatus     `json:"status,omitempty"`
}

type InstanceGroup added in v0.9.20

type InstanceGroup struct {
	Spec      *InstanceGroupSpec   `json:"spec"`
	Status    *InstanceGroupStatus `json:"status"`
	CreatedAt time.Time            `json:"createdAt"`
}

type InstanceGroupListOption added in v0.9.20

type InstanceGroupListOption struct {
	PageNo   int
	PageSize int
}

type InstanceGroupSpec added in v0.9.20

type InstanceGroupSpec struct {
	CCEInstanceGroupID string `json:"cceInstanceGroupID,omitempty"`
	InstanceGroupName  string `json:"instanceGroupName"`

	ClusterID    string            `json:"clusterID,omitempty"`
	ClusterRole  types.ClusterRole `json:"clusterRole,omitempty"`
	ShrinkPolicy ShrinkPolicy      `json:"shrinkPolicy,omitempty"`
	UpdatePolicy UpdatePolicy      `json:"updatePolicy,omitempty"`
	CleanPolicy  CleanPolicy       `json:"cleanPolicy,omitempty"`

	InstanceTemplate InstanceTemplate `json:"instanceTemplate"`
	Replicas         int              `json:"replicas"`

	ClusterAutoscalerSpec *ClusterAutoscalerSpec `json:"clusterAutoscalerSpec,omitempty"`
}

type InstanceGroupStatus added in v0.9.20

type InstanceGroupStatus struct {
	ReadyReplicas int          `json:"readyReplicas"`
	Pause         *PauseDetail `json:"pause,omitempty"`
}

InstanceGroupStatus -

type InstanceKeyType

type InstanceKeyType string

InstanceKeyType - ListInstanceByPage 参数

type InstanceKeywordType

type InstanceKeywordType string

InstanceKeywordType 节点模糊查询字段

const (
	// InstanceKeywordTypeInstanceName 节点模糊查询字段: InstanceName
	InstanceKeywordTypeInstanceName InstanceKeywordType = "instanceName"
	// InstanceKeywordTypeInstanceID 节点模糊查询字段: InstanceID
	InstanceKeywordTypeInstanceID InstanceKeywordType = "instanceID"
)

type InstanceOrderBy

type InstanceOrderBy string

InstanceOrderBy 节点查询排序字段

const (
	// InstanceOrderByInstanceName 节点查询排序字段: InstanceName
	InstanceOrderByInstanceName InstanceOrderBy = "instanceName"
	// InstanceOrderByInstanceID 节点查询排序字段: InstanceID
	InstanceOrderByInstanceID InstanceOrderBy = "instanceID"
	// InstanceOrderByCreatedAt 节点查询排序字段: CreatedAt
	InstanceOrderByCreatedAt InstanceOrderBy = "createdAt"
)

type InstancePage

type InstancePage struct {
	ClusterID    string              `json:"clusterID"`
	KeywordType  InstanceKeywordType `json:"keywordType"`
	Keyword      string              `json:"keyword"`
	OrderBy      InstanceOrderBy     `json:"orderBy"`
	Order        Order               `json:"order"`
	PageNo       int                 `json:"pageNo"`
	PageSize     int                 `json:"pageSize"`
	TotalCount   int                 `json:"totalCount"`
	InstanceList []*Instance         `json:"instanceList"`
}

InstancePage - 节点分页查询返回

type InstanceSet

type InstanceSet struct {
	InstanceSpec types.InstanceSpec `json:"instanceSpec"`
	Count        int                `json:"count"`
}

type InstanceStatus

type InstanceStatus struct {
	Machine Machine `json:"machine"`

	InstancePhase types.InstancePhase `json:"instancePhase"`
	MachineStatus types.ServerStatus  `json:"machineStatus"`
}

InstanceStatus - Instance Status

type InstanceTemplate

type InstanceTemplate struct {
	types.InstanceSpec `json:",inline"`
}

type Interface

type Interface interface {
	CreateCluster(args *CreateClusterArgs) (*CreateClusterResponse, error)
	GetCluster(clusterID string) (*GetClusterResponse, error)
	DeleteCluster(args *DeleteClusterArgs) (*DeleteClusterResponse, error)
	ListClusters(args *ListClustersArgs) (*ListClustersResponse, error)

	CreateInstances(args *CreateInstancesArgs) (*CreateInstancesResponse, error)
	GetInstance(args *GetInstanceArgs) (*GetInstanceResponse, error)
	DeleteInstances(args *DeleteInstancesArgs) (*DeleteInstancesResponse, error)
	ListInstancesByPage(args *ListInstancesByPageArgs) (*ListInstancesResponse, error)
	CreateScaleUpInstanceGroupTask(args *CreateScaleUpInstanceGroupTaskArgs) (*CreateTaskResp, error)
	CreateScaleDownInstanceGroupTask(args *CreateScaleDownInstanceGroupTaskArgs) (*CreateTaskResp, error)

	GetClusterQuota() (*GetQuotaResponse, error)
	GetClusterNodeQuota(clusterID string) (*GetQuotaResponse, error)

	CheckContainerNetworkCIDR(args *CheckContainerNetworkCIDRArgs) (*CheckContainerNetworkCIDRResponse, error)
	CheckClusterIPCIDR(args *CheckClusterIPCIDRArgs) (*CheckClusterIPCIDRResponse, error)
	RecommendContainerCIDR(args *RecommendContainerCIDRArgs) (*RecommendContainerCIDRResponse, error)
	RecommendClusterIPCIDR(args *RecommendClusterIPCIDRArgs) (*RecommendClusterIPCIDRResponse, error)

	GetTask(args *GetTaskArgs) (*GetTaskResp, error)
	ListTasks(args *ListTasksArgs) (*ListTaskResp, error)

	GetInstanceCRD(args *GetInstanceCRDArgs) (*GetInstanceCRDResponse, error)
	UpdateInstanceCRD(args *UpdateInstanceCRDRequest) (*CommonResponse, error)
}

Interface 定义 CCE V2 SDK

type KubeConfigType added in v0.9.25

type KubeConfigType string

KubeConfigType - kube config 类型

const (
	// KubeConfigTypeInternal 使用 BLB FloatingIP
	KubeConfigTypeInternal KubeConfigType = "internal"

	// KubeConfigTypeVPC 使用 BLB VPCIP
	KubeConfigTypeVPC KubeConfigType = "vpc"

	// KubeConfigTypePublic 使用 BLB EIP
	KubeConfigTypePublic KubeConfigType = "public"
)

type ListClustersArgs

type ListClustersArgs struct {
	KeywordType ClusterKeywordType
	Keyword     string
	OrderBy     ClusterOrderBy
	Order       Order
	PageNum     int
	PageSize    int
}

type ListClustersResponse

type ListClustersResponse struct {
	ClusterPage *ClusterPage `json:"clusterPage"`
	RequestID   string       `json:"requestID"`
}

ListClustersResponse - List 用户 Cluster 返回

type ListInstanceByInstanceGroupIDArgs added in v0.9.20

type ListInstanceByInstanceGroupIDArgs struct {
	ClusterID       string
	InstanceGroupID string
	PageNo          int
	PageSize        int
}

type ListInstanceGroupPage added in v0.9.20

type ListInstanceGroupPage struct {
	PageNo     int              `json:"pageNo"`
	PageSize   int              `json:"pageSize"`
	TotalCount int              `json:"totalCount"`
	List       []*InstanceGroup `json:"list"`
}

type ListInstanceGroupResponse added in v0.9.20

type ListInstanceGroupResponse struct {
	CommonResponse
	Page ListInstanceGroupPage `json:"page"`
}

type ListInstanceGroupsArgs added in v0.9.20

type ListInstanceGroupsArgs struct {
	ClusterID  string
	ListOption *InstanceGroupListOption
}

type ListInstancesByInstanceGroupIDPage added in v0.9.20

type ListInstancesByInstanceGroupIDPage struct {
	PageNo     int         `json:"pageNo"`
	PageSize   int         `json:"pageSize"`
	TotalCount int         `json:"totalCount"`
	List       []*Instance `json:"list"`
}

type ListInstancesByInstanceGroupIDResponse added in v0.9.20

type ListInstancesByInstanceGroupIDResponse struct {
	CommonResponse
	Page ListInstancesByInstanceGroupIDPage `json:"page"`
}

type ListInstancesByPageArgs

type ListInstancesByPageArgs struct {
	ClusterID string
	Params    *ListInstancesByPageParams
}

type ListInstancesByPageParams

type ListInstancesByPageParams struct {
	KeywordType          InstanceKeywordType `json:"keywordType"`
	Keyword              string              `json:"keyword"`
	OrderBy              InstanceOrderBy     `json:"orderBy"`
	Order                Order               `json:"order"`
	PageNo               int                 `json:"pageNo"`
	PageSize             int                 `json:"pageSize"`
	EnableInternalFields bool                `json:"enableInternalFields"`
}

ListInstancesByPageParams - 分页查询集群实例列表参数

type ListInstancesResponse

type ListInstancesResponse struct {
	InstancePage *InstancePage `json:"instancePage"`
	RequestID    string        `json:"requestID"`
}

ListInstancesResponse - List Instances 返回

type ListTaskPage added in v0.9.76

type ListTaskPage struct {
	PageNo     int           `json:"pageNo,omitempty"`
	PageSize   int           `json:"pageSize,omitempty"`
	TotalCount int           `json:"totalCount"`
	Items      []*types.Task `json:"items"`
}

type ListTaskResp added in v0.9.76

type ListTaskResp struct {
	CommonResponse
	Page ListTaskPage
}

type ListTasksArgs added in v0.9.76

type ListTasksArgs struct {
	TaskType types.TaskType
	TargetID string
	PageNo   int
	PageSize int
}

type Machine

type Machine struct {
	InstanceID string `json:"instanceID"`

	OrderID string `json:"orderID,omitempty"`

	MountList []types.MountConfig `json:"mountList,omitempty"`

	VPCIP     string `json:"vpcIP,omitempty"`
	VPCIPIPv6 string `json:"vpcIPIPv6,omitempty"`

	EIP string `json:"eip,omitempty"`
}

Machine - 定义机器相关信息

type NetworkConflictInfo

type NetworkConflictInfo struct {
	IsConflict            bool                   `json:"isConflict"`
	ErrMsg                string                 `json:"errMsg"`
	ContainerCIDRConflict *ContainerCIDRConflict `json:"containerCIDRConflict"` // 容器网段冲突信息
	ClusterIPCIDRConflict *ClusterIPCIDRConflict `json:"clusterIPCIDRConflict"` // ClusterIP 网段冲突信息
}

NetworkConflictInfo 容器网络整体配置冲突信息

type NetworkConflictType

type NetworkConflictType string

NetworkConflictType 冲突类型

const (
	// ContainerCIDRAndNodeCIDRConflict 容器网段和本集群的节点网段冲突
	ContainerCIDRAndNodeCIDRConflict NetworkConflictType = "ContainerCIDRAndNodeCIDR"
	// ContainerCIDRAndExistedClusterContainerCIDRConflict 容器网段和 VPC 内已有集群的容器网段冲突
	ContainerCIDRAndExistedClusterContainerCIDRConflict NetworkConflictType = "ContainerCIDRAndExistedClusterContainerCIDR"
	// ContainerCIDRAndVPCRouteConflict 容器网段与 VPC 路由冲突
	ContainerCIDRAndVPCRouteConflict NetworkConflictType = "ContainerCIDRAndVPCRoute"
	// ClusterIPCIDRAndNodeCIDRConflict ClusterIP 网段与本集群节点网段冲突
	ClusterIPCIDRAndNodeCIDRConflict NetworkConflictType = "ClusterIPCIDRAndNodeCIDR"
	// ClusterIPCIDRAndContainerCIDRConflict ClusterIP 网段与本集群容器网段冲突
	ClusterIPCIDRAndContainerCIDRConflict NetworkConflictType = "ClusterIPCIDRAndContainerCIDR"
)

type ObjectMeta added in v0.9.103

type ObjectMeta struct {
	Name         string `json:"name,omitempty"`
	GenerateName string `json:"generateName,omitempty"`
	ClusterName  string `json:"clusterName,omitempty"`
}

type Order

type Order string

Order 集群查询排序

const (
	// OrderASC 集群查询排序: 升序
	OrderASC Order = "ASC"
	// OrderDESC 集群查询排序: 降序
	OrderDESC Order = "DESC"
)

type PauseDetail added in v0.9.20

type PauseDetail struct {
	Paused bool   `json:"paused"`
	Reason string `json:"reason"`
}

type PrivateNetString

type PrivateNetString string

PrivateNetString IPv4/IPv6 私有网络地址类型

const (
	// PrivateIPv4Net10 - IPv4 10 段
	PrivateIPv4Net10 PrivateNetString = "10.0.0.0/8"

	// PrivateIPv4Net172 - IPv4 172 段
	PrivateIPv4Net172 PrivateNetString = "172.16.0.0/12"

	// PrivateIPv4Net192 - IPv4 192 段
	PrivateIPv4Net192 PrivateNetString = "192.168.0.0/16"

	// PrivateIPv6Net - IPv6 段
	PrivateIPv6Net PrivateNetString = "fc00::/7"
)

type RecommendClusterIPCIDRArgs

type RecommendClusterIPCIDRArgs struct {
	VPCCIDR           string `json:"vpcCIDR"`
	VPCCIDRIPv6       string `json:"vpcCIDRIPv6"`
	ContainerCIDR     string `json:"containerCIDR"`
	ContainerCIDRIPv6 string `json:"containerCIDRIPv6"`
	// ClusterMaxServiceNum 集群 Service 最大规模
	ClusterMaxServiceNum int `json:"clusterMaxServiceNum"`
	// PrivateNetCIDRs 候选的 ClusterIP 网段列表,只能从 [10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16] 里选择
	PrivateNetCIDRs     []PrivateNetString           `json:"privateNetCIDRs"`
	PrivateNetCIDRIPv6s []PrivateNetString           `json:"privateNetCIDRIPv6s"`
	IPVersion           types.ContainerNetworkIPType `json:"ipVersion"` // if not set, set ipv4
}

RecommendClusterIPCIDRRequest 推荐 ClusterIP 网段的请求参数

type RecommendClusterIPCIDRResponse

type RecommendClusterIPCIDRResponse struct {
	RecommendedClusterIPCIDRs     []string `json:"recommendedClusterIPCIDRs"`
	RecommendedClusterIPCIDRIPv6s []string `json:"recommendedClusterIPCIDRIPv6s"`
	IsSuccess                     bool     `json:"isSuccess"`
	ErrMsg                        string   `json:"errMsg"`
	RequestID                     string   `json:"requestID"`
}

RecommendClusterIPCIDRResponse 推荐 ClusterIP 网段的响应

type RecommendContainerCIDRArgs

type RecommendContainerCIDRArgs struct {
	VPCID       string `json:"vpcID"`
	VPCCIDR     string `json:"vpcCIDR"`
	VPCCIDRIPv6 string `json:"vpcCIDRIPv6"`
	// ClusterMaxNodeNum 集群节点的最大规模
	ClusterMaxNodeNum int `json:"clusterMaxNodeNum"`
	MaxPodsPerNode    int `json:"maxPodsPerNode"`
	// PrivateNetCIDRs 候选的容器网段列表,只能从 [10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16] 里选择
	PrivateNetCIDRs     []PrivateNetString           `json:"privateNetCIDRs"`
	PrivateNetCIDRIPv6s []PrivateNetString           `json:"privateNetCIDRIPv6s"`
	K8SVersion          types.K8SVersion             `json:"k8sVersion"`
	IPVersion           types.ContainerNetworkIPType `json:"ipVersion"` // if not set, set ipv4
}

RecommendContainerCIDRRequest 推荐容器网段的请求参数

type RecommendContainerCIDRResponse

type RecommendContainerCIDRResponse struct {
	RecommendedContainerCIDRs     []string `json:"recommendedContainerCIDRs"`
	RecommendedContainerCIDRIPv6s []string `json:"recommendedContainerCIDRIPv6s"`
	IsSuccess                     bool     `json:"isSuccess"`
	ErrMsg                        string   `json:"errMsg"`
	RequestID                     string   `json:"requestID"`
}

RecommendContainerCIDRResponse 推荐容器网段的响应

type ShrinkPolicy added in v0.9.20

type ShrinkPolicy string

type UpdateAutoscalerArgs added in v0.9.25

type UpdateAutoscalerArgs struct {
	ClusterID        string
	AutoscalerConfig ClusterAutoscalerConfig
}

type UpdateAutoscalerResponse added in v0.9.25

type UpdateAutoscalerResponse struct {
	CommonResponse
}

type UpdateClusterCRDArgs added in v0.9.107

type UpdateClusterCRDArgs struct {
	Cluster *ClusterCRD `json:"cluster"`
}

type UpdateClusterCRDResponses added in v0.9.107

type UpdateClusterCRDResponses struct {
}

type UpdateClusterResponse

type UpdateClusterResponse struct {
	Cluster   *Cluster `json:"cluster"`
	RequestID string   `json:"requestID"`
}

UpdateClusterResponse - 更新 Cluster 返回

type UpdateInstanceArgs added in v0.9.25

type UpdateInstanceArgs struct {
	ClusterID    string
	InstanceID   string
	InstanceSpec *types.InstanceSpec
}

type UpdateInstanceCRDRequest added in v0.9.103

type UpdateInstanceCRDRequest struct {
	Instance *InstanceCRD `json:"instance"`
}

type UpdateInstanceGroupClusterAutoscalerSpecArgs added in v0.9.20

type UpdateInstanceGroupClusterAutoscalerSpecArgs struct {
	ClusterID       string
	InstanceGroupID string
	Request         *ClusterAutoscalerSpec
}

type UpdateInstanceGroupClusterAutoscalerSpecResponse added in v0.9.20

type UpdateInstanceGroupClusterAutoscalerSpecResponse struct {
	CommonResponse
}

type UpdateInstanceGroupReplicasArgs added in v0.9.20

type UpdateInstanceGroupReplicasArgs struct {
	ClusterID       string
	InstanceGroupID string
	Request         *UpdateInstanceGroupReplicasRequest
}

type UpdateInstanceGroupReplicasRequest added in v0.9.20

type UpdateInstanceGroupReplicasRequest struct {
	Replicas       int                 `json:"replicas"`
	InstanceIDs    []string            `json:"instanceIDs"`
	DeleteInstance bool                `json:"deleteInstance"`
	DeleteOption   *types.DeleteOption `json:"deleteOption,omitempty"`
}

type UpdateInstanceGroupReplicasResponse added in v0.9.20

type UpdateInstanceGroupReplicasResponse struct {
	CommonResponse
}

type UpdateInstancesResponse

type UpdateInstancesResponse struct {
	Instance  *Instance `json:"instance"`
	RequestID string    `json:"requestID"`
}

UpdateInstancesResponse - 更新 Instances 返回

type UpdatePolicy added in v0.9.20

type UpdatePolicy string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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