cce

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

View Source
const (
	URI_PREFIX = bce.URI_PREFIX + "v1"

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

	REQUEST_CLUSTER_URL = "/cluster"
	REQUEST_NODE_URL    = "/node"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedOptions

type AdvancedOptions struct {
	KubeProxyMode         KubeProxyMode `json:"kubeProxyMode,omitempty"`
	SecureContainerEnable bool          `json:"secureContainerEnable,omitempty"`
	SetOSSecurity         bool          `json:"setOSSecurity,omitempty"`
	CniMode               CniMode       `json:"cniMode,omitempty"`
	CniType               CniType       `json:"cniType,omitempty"`
	DnsMode               DNSMode       `json:"dnsMode,omitempty"`
	MaxPodNum             int           `json:"maxPodNum,omitempty"`
}

type BaseCreateOrderRequestVo

type BaseCreateOrderRequestVo struct {
	Items []Item `json:"items"`
}

type BccConfig

type BccConfig struct {
	Name                string       `json:"name,omitempty"`
	KeypairId           string       `json:"keypairId,omitempty"`
	ProductType         ProductType  `json:"productType"`
	LogicalZone         string       `json:"logicalZone,omitempty"`
	InstanceType        InstanceType `json:"instanceType"`
	GpuCard             string       `json:"gpuCard,omitempty"`
	GpuCount            int          `json:"gpuCount"`
	Cpu                 int          `json:"cpu"`
	Memory              int          `json:"memory"`
	ImageType           ImageType    `json:"imageType"`
	SubnetUuid          string       `json:"subnetUuid"`
	SecurityGroupId     string       `json:"securityGroupId"`
	AdminPass           string       `json:"adminPass,omitempty"`
	PurchaseLength      int          `json:"purchaseLength,omitempty"`
	PurchaseNum         int          `json:"purchaseNum"`
	RootDiskSizeInGb    int          `json:"rootDiskSizeInGb,omitempty"`
	RootDiskStorageType VolumeType   `json:"rootDiskStorageType,omitempty"`
	AutoRenewTimeUnit   string       `json:"autoRenewTimeUnit,omitempty"`
	AutoRenewTime       int          `json:"autoRenewTime,omitempty"`
	AutoRenew           bool         `json:"autoRenew,omitempty"`
	ImageId             string       `json:"imageId"`
	ServiceType         ServiceType  `json:"serviceType"`
}

type CceNodeInfo

type CceNodeInfo struct {
	InstanceId string `json:"instanceId"`
	AdminPass  string `json:"adminPass,omitempty"`
}

type CdsConfig

type CdsConfig struct {
	ProductType       ProductType      `json:"productType"`
	LogicalZone       string           `json:"logicalZone"`
	PurchaseNum       int              `json:"purchaseNum"`
	PurchaseLength    int              `json:"purchaseLength,omitempty"`
	AutoRenewTimeUnit string           `json:"autoRenewTimeUnit,omitempty"`
	AutoRenewTime     int              `json:"autoRenewTime,omitempty"`
	CdsDiskSize       []DiskSizeConfig `json:"cdsDiskSize"`
	ServiceType       ServiceType      `json:"serviceType"`
}

type CdsPreMountInfo

type CdsPreMountInfo struct {
	MountPath string           `json:"mountPath"`
	CdsConfig []DiskSizeConfig `json:"cdsConfig"`
}

type Client

type Client struct {
	*bce.BceClient
}

Client of EIP service is a kind of BceClient, so derived from BceClient

func NewClient

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

func (*Client) CreateCluster

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

CreateCluster - create an CCE Cluster with the specific parameters

PARAMS:

  • args: the arguments to create a cce cluster

RETURNS:

  • *CreateClusterResult: the result of create cluster, contains new Cluster's uuid and order id

func (*Client) DeleteCluster

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

DeleteCluster - delete a CCE Cluster

PARAMS:

  • args: the arguments to delete a cce cluster

func (*Client) GetCluster

func (c *Client) GetCluster(clusterUuid string) (*GetClusterResult, error)

GetCluster - get a CCE Cluster with the specific cluster uuid

PARAMS:

  • args: the specific cluster uuid

RETURNS:

  • *GetClusterResult: the detail information about the CCE Cluster

func (*Client) GetContainerNet

func (c *Client) GetContainerNet(args *GetContainerNetArgs) (*GetContainerNetResult, error)

GetContainerNet - get container net in vpc

PARAMS:

  • args: the arguments to get args

RETURNS:

  • *GetContainerNetResult: the result of container net

func (*Client) GetKubeConfig

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

GetKubeConfig - get config file of CCE Cluster

PARAMS:

  • args: the arguments to get config file of a cce cluster

RETURNS:

  • *GetKubeConfigResult: the kubeconfig file data

func (*Client) ListClusters

func (c *Client) ListClusters(args *ListClusterArgs) (*ListClusterResult, error)

ListClusters - list CCE Clusters with the specific parameters

PARAMS:

  • args: the arguments to list cce cluster

RETURNS:

  • *ListClusterResult: the result of list cluster

func (*Client) ListExistedBccNode

func (c *Client) ListExistedBccNode(args *ListExistedNodeArgs) (*ListExistedNodeResult, error)

ListExistedBccNode - list all bcc nodes which can shifted into CCE cluster

PARAMS:

  • args: the arguments to list bcc nodes

RETURNS:

  • *ListExistedNodeResult: the result of list nodes

func (*Client) ListNodes

func (c *Client) ListNodes(args *ListNodeArgs) (*ListNodeResult, error)

ListNodes - list all nodes in CCE Cluster

PARAMS:

  • args: the arguments to list all nodes

RETURNS:

  • *ListNodeResult: the result of list nodes, contains a Cluster's nodes

func (*Client) ListVersions

func (c *Client) ListVersions() (*ListVersionsResult, error)

ListVersions - list all support kubernetes version

RETURNS:

  • *ListVersionsResult: all support kubernetes version list

func (*Client) ScalingDown

func (c *Client) ScalingDown(args *ScalingDownArgs) error

ScalingDown - scaling down a CCE Cluster

PARAMS:

  • args: the arguments to scaling down a cce cluster

func (*Client) ScalingUp

func (c *Client) ScalingUp(args *ScalingUpArgs) (*ScalingUpResult, error)

ScalingUp - scaling up a CCE Cluster

PARAMS:

  • args: the arguments to create a cce cluster

RETURNS:

  • *ScalingUpResult: the result of scaling up cluster, contains new Cluster's uuid and order id

func (*Client) ShiftInNode

func (c *Client) ShiftInNode(args *ShiftInNodeArgs) error

ShiftInNode - shift nodes into cluster

PARAMS:

  • args: the arguments about shift nodes into cce cluster

func (*Client) ShiftOutNode

func (c *Client) ShiftOutNode(args *ShiftOutNodeArgs) error

ShiftOutNode - shift nodes out from CCE Cluster

PARAMS:

  • args: the arguments about shift nodes out from cce cluster

type Cluster

type Cluster struct {
	ClusterUuid       string        `json:"clusterUuid"`
	ClusterName       string        `json:"clusterName"`
	SlaveVmCount      int           `json:"slaveVmCount"`
	MasterVmCount     int           `json:"masterVmCount"`
	ContainerNet      string        `json:"containerNet"`
	Status            ClusterStatus `json:"status"`
	Region            string        `json:"region"`
	CreateTime        time.Time     `json:"createTime"`
	DeleteTime        time.Time     `json:"deleteTime"`
	AllInstanceNormal bool          `json:"allInstanceNormal"`
	InstanceList      []SimpleNode  `json:"instanceList"`
	DccUuid           string        `json:"dccUuid"`
	HasPrepay         bool          `json:"hasPrepay"`
	VpcId             string        `json:"vpcId"`
	InstanceMode      string        `json:"instanceMode"`
	MasterExposed     bool          `json:"masterExposed"`
}

type ClusterStatus

type ClusterStatus string
const (
	ClusterStatusRunning             ClusterStatus = "RUNNING"
	ClusterStatusCreating            ClusterStatus = "CREATING"
	ClusterStatusCreateFailed        ClusterStatus = "CREATE_FAILED"
	ClusterStatusDeleting            ClusterStatus = "DELETING"
	ClusterStatusDeletingFailed      ClusterStatus = "DELETE_FAILED"
	ClusterStatusMasterUpgrading     ClusterStatus = "MASTER_UPGRADING"
	ClusterStatusMasterUpgradeFailed ClusterStatus = "MASTER_UPGRADE_FAILED"
	ClusterStatusError               ClusterStatus = "ERROR"
	ClusterStatusDeleted             ClusterStatus = "DELETED"
)

type CniMode

type CniMode string
const (
	CniModeKubenet CniMode = "kubenet"
	CniModeCni     CniMode = "cni"
)

type CniType

type CniType string
const (
	CniTypeEmpty                 CniType = ""
	CniTypeRouteVeth             CniType = "VPC_ROUTE_VETH"
	CniTypeRouteIpvlan           CniType = "VPC_ROUTE_IPVLAN"
	CniTypeRouteAutoDetect       CniType = "VPC_ROUTE_AUTODETECT"
	CniTypeSecondaryIpVeth       CniType = "VPC_SECONDARY_IP_VETH"
	CniTypeSecondaryIpIpvlan     CniType = "VPC_SECONDARY_IP_IPVLAN"
	CniTypeSecondaryIpAutoDetect CniType = "VPC_SECONDARY_IP_AUTODETECT"
)

type CreateClusterArgs

type CreateClusterArgs struct {
	ClusterName        string                    `json:"clusterName"`
	Version            string                    `json:"version"`
	MainAvailableZone  string                    `json:"mainAvailableZone"`
	ContainerNet       string                    `json:"containerNet"`
	AdvancedOptions    *AdvancedOptions          `json:"advancedOptions,omitempty"`
	CdsPreMountInfo    *CdsPreMountInfo          `json:"cdsPreMountInfo,omitempty"`
	Comment            string                    `json:"comment,omitempty"`
	DeployMode         DeployMode                `json:"deployMode"`
	DccUuid            string                    `json:"dccUuid,omitempty"`
	MasterExposed      bool                      `json:"masterExposed,omitempty"`
	OrderContent       *BaseCreateOrderRequestVo `json:"orderContent"`
	MasterOrderContent *BaseCreateOrderRequestVo `json:"masterOrderContent,omitempty"`
}

type CreateClusterResult

type CreateClusterResult struct {
	ClusterUuid string   `json:"clusterUuid"`
	OrderId     []string `json:"orderId"`
}

type DNSMode

type DNSMode string
const (
	DNSModeKubeDNS DNSMode = "kubeDNS"
	DNSModeCoreDNS DNSMode = "coreDNS"
)

type DeleteClusterArgs

type DeleteClusterArgs struct {
	ClusterUuid  string
	DeleteEipCds bool
	DeleteSnap   bool
}

type DeployMode

type DeployMode string
const (
	DeployModeBcc DeployMode = "BCC"
	DeployModeDcc DeployMode = "DCC"
)

type DiskSizeConfig

type DiskSizeConfig struct {
	Size       string     `json:"size"`
	VolumeType VolumeType `json:"volumeType"`
	SnapshotId string     `json:"snapshotId,omitempty"`
}

type EipConfig

type EipConfig struct {
	ProductType       ProductType `json:"productType"`
	BandwidthInMbps   int         `json:"bandwidthInMbps"`
	SubProductType    EipType     `json:"subProductType"`
	PurchaseNum       int         `json:"purchaseNum"`
	PurchaseLength    int         `json:"purchaseLength,omitempty"`
	AutoRenewTime     int         `json:"autoRenewTime,omitempty"`
	AutoRenewTimeUnit string      `json:"autoRenewTimeUnit,omitempty"`
	Name              string      `json:"name,omitempty"`
	ServiceType       ServiceType `json:"serviceType"`
}

type EipType

type EipType string
const (
	EipTypeBandwidth EipType = "bandwidth"
	EipTypeNetraffic EipType = "netraffic"
)

type GetClusterResult

type GetClusterResult struct {
	ClusterUuid           string            `json:"clusterUuid"`
	ClusterName           string            `json:"clusterName"`
	Version               string            `json:"version"`
	Region                string            `json:"region"`
	SlaveVmCount          int               `json:"slaveVmCount"`
	MasterVmCount         int               `json:"masterVmCount"`
	VpcId                 string            `json:"vpcId"`
	VpcUuid               string            `json:"vpcUuid"`
	VpcCidr               string            `json:"vpcCidr"`
	ZoneSubnetMap         map[string]string `json:"zoneSubnetMap"`
	ContainerNet          string            `json:"containerNet"`
	AdvancedOptions       *AdvancedOptions  `json:"advancedOptions"`
	Status                ClusterStatus     `json:"status"`
	CreateStartTime       time.Time         `json:"createStartTime"`
	DeleteTime            time.Time         `json:"deleteTime"`
	Comment               string            `json:"comment"`
	InstanceMode          string            `json:"instanceMode"`
	HasPrepay             bool              `json:"hasPrepay"`
	VpcName               string            `json:"vpcName"`
	SecureContainerEnable bool              `json:"secureContainerEnable"`
	MasterZoneSubnetMap   map[string]string `json:"masterZoneSubnetMap"`
	MasterExposed         bool              `json:"masterExposed"`
}

type GetContainerNetArgs

type GetContainerNetArgs struct {
	VpcShortId string `json:"vpcShortId"`
	VpcCidr    string `json:"vpcCidr"`
	Size       int    `json:"size"`
}

type GetContainerNetResult

type GetContainerNetResult struct {
	ContainerNet string `json:"containerNet"`
	Capacity     int    `json:"capacity"`
}

type GetKubeConfigArgs

type GetKubeConfigArgs struct {
	ClusterUuid string
	Type        KubeConfigType
}

type GetKubeConfigResult

type GetKubeConfigResult struct {
	Data string `json:"data"`
}

type ImageType

type ImageType string
const (
	ImageTypeCommon    ImageType = "common"
	ImageTypeCustom    ImageType = "custom"
	ImageTypeGpu       ImageType = "gpuBccImage"
	ImageTypeGpuCustom ImageType = "gpuBccCustom"
	ImageTypeSharing   ImageType = "sharing"
)

type InstanceType

type InstanceType string
const (
	InstanceTypeG1     InstanceType = "0"
	InstanceTypeDCC    InstanceType = "1"
	InstanceTypeBCC    InstanceType = "2"
	InstanceTypeC1     InstanceType = "4"
	InstanceTypeG2     InstanceType = "7"
	InstanceTypeGPU    InstanceType = "9"
	InstanceTypeG3     InstanceType = "10"
	InstanceTypeC2     InstanceType = "11"
	InstanceTypeG4     InstanceType = "13"
	InstanceTypeVGPU   InstanceType = "15"
	InstanceTypeKunlun InstanceType = "25"
)

type Item

type Item struct {
	Config interface{} `json:"config"`
}

type KeywordType

type KeywordType string
const (
	KeywordTypeName       KeywordType = "name"
	KeywordTypeInstanceId KeywordType = "instanceId"
)

type KubeConfigType

type KubeConfigType string
const (
	KubeConfigTypeDefault  KubeConfigType = "default"
	KubeConfigTypeInternal KubeConfigType = "internal"
	KubeConfigTypeIntraVpc KubeConfigType = "intraVpc"
)

type KubeProxyMode

type KubeProxyMode string
const (
	KubeProxyModeIptables KubeProxyMode = "iptables"
	KubeProxyModeIpvs     KubeProxyMode = "ipvs"
)

type ListClusterArgs

type ListClusterArgs struct {
	Status  ClusterStatus
	Marker  string
	MaxKeys int
}

type ListClusterResult

type ListClusterResult struct {
	Marker      string    `json:"marker"`
	IsTruncated bool      `json:"isTruncated"`
	NextMarker  string    `json:"nextMarker"`
	MaxKeys     int       `json:"maxKeys"`
	Clusters    []Cluster `json:"clusters"`
}

type ListExistedNodeArgs

type ListExistedNodeArgs struct {
	ClusterUuid  string            `json:"clusterUuid"`
	VpcId        string            `json:"vpcId,omitempty"`
	VpcCidr      string            `json:"vpcCidr,omitempty"`
	InstanceType ShiftInstanceType `json:"instanceType,omitempty"`
	BBCFlavorId  string            `json:"bbcFlavorId,omitempty"`
	KeywordType  KeywordType       `json:"keywordType,omitempty"`
	Keyword      string            `json:"keyword,omitempty"`
	OrderBy      string            `json:"orderBy,omitempty"`
	Order        Order             `json:"order,omitempty"`
	PageNo       int               `json:"pageNo,omitempty"`
	PageSize     int               `json:"pageSize,omitempty"`
}

type ListExistedNodeResult

type ListExistedNodeResult struct {
	ClusterUuid string             `json:"clusterUuid"`
	OrderBy     string             `json:"orderBy"`
	Order       string             `json:"order"`
	PageNo      int                `json:"pageNo"`
	PageSize    int                `json:"pageSize"`
	TotalCount  int                `json:"totalCount"`
	NodeList    []ServerForDisplay `json:"nodeList"`
}

type ListNodeArgs

type ListNodeArgs struct {
	ClusterUuid string
	Marker      string
	MaxKeys     int
}

type ListNodeResult

type ListNodeResult struct {
	Marker      string `json:"marker"`
	IsTruncated bool   `json:"isTruncated"`
	NextMarker  string `json:"nextMarker"`
	MaxKeys     int    `json:"maxKeys"`
	Nodes       []Node `json:"nodes"`
}

type ListVersionsResult

type ListVersionsResult struct {
	Data []string `json:"data"`
}

type Node

type Node struct {
	InstanceShortId string    `json:"instanceShortId"`
	InstanceUuid    string    `json:"instanceUuid"`
	InstanceName    string    `json:"instanceName"`
	ClusterUuid     string    `json:"clusterUuid"`
	AvailableZone   string    `json:"availableZone"`
	VpcId           string    `json:"vpcId"`
	VpcCidr         string    `json:"vpcCidr"`
	SubnetId        string    `json:"subnetId"`
	SubnetType      string    `json:"subnetType"`
	Eip             string    `json:"eip"`
	EipBandwidth    int       `json:"eipBandwidth"`
	Cpu             int       `json:"cpu"`
	Memory          int       `json:"memory"`
	DiskSize        int       `json:"diskSize"`
	SysDisk         int       `json:"sysDisk"`
	InstanceType    string    `json:"instanceType"`
	Blb             string    `json:"blb"`
	FloatingIp      string    `json:"floatingIp"`
	FixIp           string    `json:"fixIp"`
	CreateTime      time.Time `json:"createTime"`
	DeleteTime      time.Time `json:"deleteTime"`
	Status          string    `json:"status"`
	ExpireTime      time.Time `json:"expireTime"`
	PaymentMethod   string    `json:"paymentMethod"`
	RuntimeVersion  string    `json:"runtimeVersion"`
}

type NodeInfo

type NodeInfo struct {
	InstanceId string `json:"instanceId"`
}

type Order

type Order string
const (
	OrderAsc  Order = "asc"
	OrderDesc Order = "desc"
)

type ProductType

type ProductType string
const (
	ProductTypePostpay ProductType = "postpay"
	ProductTypePrepay  ProductType = "prepay"
)

type ScalingDownArgs

type ScalingDownArgs struct {
	ClusterUuid  string     `json:"clusterUuid"`
	DeleteEipCds bool       `json:"-"`
	DeleteSnap   bool       `json:"-"`
	NodeInfo     []NodeInfo `json:"nodeInfo"`
}

type ScalingUpArgs

type ScalingUpArgs struct {
	ClusterUuid     string                    `json:"clusterUuid"`
	DccUuid         string                    `json:"dccUuid,omitempty"`
	CdsPreMountInfo *CdsPreMountInfo          `json:"cdsPreMountInfo,omitempty"`
	OrderContent    *BaseCreateOrderRequestVo `json:"orderContent"`
}

type ScalingUpResult

type ScalingUpResult struct {
	ClusterUuid string   `json:"clusterUuid"`
	OrderId     []string `json:"orderId"`
}

type ServerForDisplay

type ServerForDisplay struct {
	InstanceId string `json:"instanceId"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	Payment    string `json:"payment"`
	InternalIp string `json:"internalIp"`
}

type ServiceType

type ServiceType string
const (
	ServiceTypeBCC ServiceType = "BCC"
	ServiceTypeCDS ServiceType = "CDS"
	ServiceTypeEIP ServiceType = "EIP"
)

type ShiftInNodeArgs

type ShiftInNodeArgs struct {
	ClusterUuid  string            `json:"clusterUuid"`
	NeedRebuild  bool              `json:"needRebuild"`
	ImageId      string            `json:"imageId,omitempty"`
	AdminPass    string            `json:"adminPass"`
	InstanceType ShiftInstanceType `json:"instanceType"`
	NodeInfoList []CceNodeInfo     `json:"nodeInfoList"`
}

type ShiftInstanceType

type ShiftInstanceType string
const (
	ShiftInstanceTypeBcc ShiftInstanceType = "BCC"
	ShiftInstanceTypeBBC ShiftInstanceType = "BBC"
)

type ShiftOutNodeArgs

type ShiftOutNodeArgs struct {
	ClusterUuid  string        `json:"clusterUuid"`
	NodeInfoList []CceNodeInfo `json:"nodeInfoList"`
}

type SimpleNode

type SimpleNode struct {
	InstanceShortId string        `json:"instanceShortId"`
	InstanceUuid    string        `json:"instanceUuid"`
	InstanceName    string        `json:"instanceName"`
	ClusterUuid     string        `json:"clusterUuid"`
	Status          ClusterStatus `json:"status"`
}

type VolumeType

type VolumeType string
const (
	VolumeTypeSata       VolumeType = "sata"
	VolumeTypeSsd        VolumeType = "ssd"
	VolumeTypePremiumSsd VolumeType = "premium_ssd"
)

Jump to

Keyboard shortcuts

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