types

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InstanceTypeDCC DCC 类型
	InstanceTypeDCC bccapi.InstanceType = "DCC"
	// InstanceTypeBBC BBC 类型
	InstanceTypeBBC bccapi.InstanceType = "BBC"
	// InstanceTypeBBCGPU BBC GPU 类型
	InstanceTypeBBCGPU bccapi.InstanceType = "BBC_GPU"
)
View Source
const (
	// LatestSupportedK8SVersion latest K8S Version that we supported
	LatestSupportedK8SVersion = "1.16.8"

	// DefaultRuntime default runtime
	DefaultRuntime = "docker"

	// LatestSupportedDockerVersion default docker version
	LatestSupportedDockerVersion = "18.09.2"

	CCEPrefix = "cce-"

	// ClusterIDLabelKey 关联 ClusterCRD 和 InstanceCRD 或 InstanceGroupCRD
	ClusterIDLabelKey = "cluster-id"

	ClusterRoleLabelKey = "cluster-role"

	DoNotHandle = "not-handler-by-cce"
)
View Source
const (
	DefaultShrinkPolicy               = PriorityShrinkPolicy
	PriorityShrinkPolicy ShrinkPolicy = "Priority"
	RandomShrinkPolicy   ShrinkPolicy = "Random"

	DefaultUpdatePolicy                  = ConcurrencyUpdatePolicy
	RollingUpdatePolicy     UpdatePolicy = "Rolling"
	ConcurrencyUpdatePolicy UpdatePolicy = "Concurrency"

	DefaultCleanPolicy             = RemainCleanPolicy
	RemainCleanPolicy  CleanPolicy = "Remain"
	DeleteCleanPolicy  CleanPolicy = "Delete"
)
View Source
const (
	ImageTypeService bccapi.ImageType = "service"
)

Variables

View Source
var SupportedClusterHA = map[ClusterHA]string{
	ClusterHALow:    "",
	ClusterHAMedium: "",
	ClusterHAHigh:   "",
}

SupportedClusterHA - CCE 支持的 ClusterHA 类型

View Source
var SupportedContainerNetworkMode = map[ContainerNetworkMode]string{
	ContainerNetworkModeKubenet:                  "",
	ContainerNetworkModeVPCCNI:                   "",
	ContainerNetworkModeVPCRouteAutoDetect:       "",
	ContainerNetworkModeVPCRouteVeth:             "",
	ContainerNetworkModeVPCRouteIPVlan:           "",
	ContainerNetworkModeVPCSecondaryIPAutoDetect: "",
	ContainerNetworkModeVPCSecondaryIPVeth:       "",
	ContainerNetworkModeVPCSecondaryIPIPVlan:     "",
}

SupportedContainerNetworkMode - CCE 支持的容器网络类型

View Source
var SupportedGPUType = map[GPUType]string{
	GPUTypeV100_32: "",
	GPUTypeV100_16: "",
	GPUTypeP40:     "",
	GPUTypeP4:      "",
	GPUTypeK40:     "",
	GPUTypeDLCard:  "",
}

SupportedGPUType - CCE 支持的 GPU 类型

SupportedImageType - CCE 支持镜像类型

View Source
var SupportedInstanceType = map[bccapi.InstanceType]string{
	bccapi.InstanceTypeN1: "",
	bccapi.InstanceTypeN2: "",
	bccapi.InstanceTypeN3: "",
	bccapi.InstanceTypeN4: "",
	bccapi.InstanceTypeN5: "",
	bccapi.InstanceTypeC1: "",
	bccapi.InstanceTypeC2: "",
	bccapi.InstanceTypeS1: "",
	bccapi.InstanceTypeG1: "",
	bccapi.InstanceTypeF1: "",

	InstanceTypeDCC:    "",
	InstanceTypeBBC:    "",
	InstanceTypeBBCGPU: "",
}

SupportedInstanceType - CCE 支持的 Instance 类型

View Source
var SupportedK8SVersions = map[K8SVersion]string{
	K8S_1_13_10: "",
	K8S_1_16_8:  "",
}

SupportedK8SVersions - CCE 支持的 K8s 版本

View Source
var SupportedKubeProxyMode = map[KubeProxyMode]string{
	KubeProxyModeIptables: "",
	KubeProxyModeIPVS:     "",
}
View Source
var SupportedMasterType = map[MasterType]string{
	MasterTypeManaged:    "",
	MasterTypeCustom:     "",
	MasterTypeServerless: "",
}

SupportedMasterType - CCE 支持 Master 类型

View Source
var SupportedRootDiskStorageType = map[bccapi.StorageType]string{
	bccapi.StorageTypeHP1:      "",
	bccapi.StorageTypeCloudHP1: "",
}

SupportedRootDiskStorageType - CCE 支持的 RootDiskStorage 类型

View Source
var SupportedRuntimeType = map[RuntimeType]string{
	RuntimeTypeDocker: "",
}

SupportedStorageType - CCE 支持的 Storage 类型

Functions

This section is empty.

Types

type AvailableZone

type AvailableZone string

AvailableZone 可用区

const (
	// ZoneA 可用区 A
	AvailableZoneA AvailableZone = "zoneA"

	// ZoneB 可用区 B
	AvailableZoneB AvailableZone = "zoneB"

	// ZoneC 可用区 C
	AvailableZoneC AvailableZone = "zoneC"

	// ZoneD 可用区 D
	AvailableZoneD AvailableZone = "zoneD"

	// ZoneE 可用区 E
	AvailableZoneE AvailableZone = "zoneE"

	// ZoneF 可用区 F
	AvailableZoneF AvailableZone = "zoneF"
)

type BBCOption

type BBCOption struct {
	// 是否保留数据
	ReserveData bool `json:"reserveData,omitempty"`
	// 磁盘阵列类型 ID
	RaidID string `json:"raidID,omitempty"`
	// 系统盘分配大小
	SysDiskSize int `json:"sysDiskSize,omitempty"`
}

BBCOption BBC 相关配置

type BLBType

type BLBType string

BLBType for load balancer type

const (
	// BLBTypeNormal 普通 BLB 类型
	BLBTypeNormal BLBType = "normal"

	// BLBTypeApplication 应用型 BLB 类型
	BLBTypeApplication BLBType = "application"
)

type BillingMethod

type BillingMethod string

BillingMethod 计费方式

const (
	// BillingMethodByTraffic 按照流量计费
	BillingMethodByTraffic BillingMethod = "ByTraffic"
	// BillingMethodByBandwidth 按带宽计费
	BillingMethodByBandwidth BillingMethod = "ByBandwidth"
)

type CDSConfig

type CDSConfig struct {
	Path        string             `json:"diskPath,omitempty"`
	StorageType bccapi.StorageType `json:"storageType,omitempty"`
	CDSSize     int                `json:"cdsSize,omitempty"`
	SnapshotID  string             `json:"snapshotID,omitempty"`
}

CDSConfig clone from BCC

type CDSConfigList

type CDSConfigList []CDSConfig

type CleanPolicy

type CleanPolicy string

type ClusterAutoscalerSpec

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

type ClusterHA

type ClusterHA int

ClusterHA Cluster Master 对应副本数

const (
	// ClusterHALow 单 Master
	ClusterHALow ClusterHA = 1
	// ClusterHAMedium 三 Master
	ClusterHAMedium ClusterHA = 3
	// ClusterHAHigh 五 Master
	ClusterHAHigh ClusterHA = 5
	// ClusterHAServerless Cluster Master 副本数
	ClusterHAServerless ClusterHA = 2
)

type ClusterPhase

type ClusterPhase string

ClusterPhase for CCE K8S Cluster Phase

const (
	// ClusterPhasePending 创建 Cluster 时默认状态
	ClusterPhasePending ClusterPhase = "pending"

	// ClusterPhaseProvisioning IaaS 相关资源正在创建中
	ClusterPhaseProvisioning ClusterPhase = "provisioning"

	// ClusterPhaseProvisioned IaaS 相关资源已经 Ready
	ClusterPhaseProvisioned ClusterPhase = "provisioned"

	// ClusterPhaseRunning 集群运行正常
	ClusterPhaseRunning ClusterPhase = "running"

	// ClusterPhaseCreateFailed 集群创建失败
	ClusterPhaseCreateFailed ClusterPhase = "create_failed"

	// ClusterPhaseDeleting 集群正在删除
	ClusterPhaseDeleting ClusterPhase = "deleting"

	// ClusterPhaseDeleted 集群删除完成
	ClusterPhaseDeleted ClusterPhase = "deleted"

	// ClusterPhaseDeleteFailed 集群删除失败
	ClusterPhaseDeleteFailed ClusterPhase = "delete_failed"
)

type ClusterRole

type ClusterRole string

ClusterRole master & slave

const (
	// ClusterRoleMaster K8S master
	ClusterRoleMaster ClusterRole = "master"

	// ClusterRoleNode K8S node
	ClusterRoleNode ClusterRole = "node"
)

type ClusterSpec

type ClusterSpec struct {

	// 创建集群时无需传入ClusterID
	ClusterID string `json:"clusterID,omitempty" `

	// ClusterName 由用户指定
	ClusterName string `json:"clusterName" valid:"Required"`

	ClusterType ClusterType `json:"clusterType,omitempty" valid:"Required"`

	Description string `json:"description,omitempty"`

	K8SVersion K8SVersion `json:"k8sVersion,omitempty"`

	RuntimeType    RuntimeType `json:"runtimeType,omitempty"`
	RuntimeVersion string      `json:"runtimeVersion,omitempty"`

	// VPCCIDR 无需用户设置
	VPCID       string `json:"vpcID,omitempty" valid:"Required"`
	VPCCIDR     string `json:"vpcCIDR,omitempty"`
	VPCCIDRIPv6 string `json:"vpcCIDRIPv6,omitempty"`

	// PluginListType CCE 插件类型
	Plugins []string `json:"plugins,omitempty"`

	MasterConfig           MasterConfig           `json:"masterConfig,omitempty" valid:"Required"`
	ContainerNetworkConfig ContainerNetworkConfig `json:"containerNetworkConfig,omitempty" valid:"Required"`

	// K8S 自定义配置
	K8SCustomConfig K8SCustomConfig `json:"k8sCustomConfig,omitempty"`
}

创建集群时使用的ClusterSpec

type ClusterType

type ClusterType string

ClusterType usually used to init Provider and it represents the difference between IaaS

const (
	// ClusterTypeNormal = 普通类型集群
	ClusterTypeNormal ClusterType = "normal"
)

type ContainerNetworkConfig

type ContainerNetworkConfig struct {
	// CCE 支持网络类型: kubenet 及 vpc-cni
	Mode ContainerNetworkMode `json:"mode,omitempty"` // If not set, set mode = kubenet

	// ENI 网络模式子网
	ENIVPCSubnetIDs    map[AvailableZone][]string `json:"eniVPCSubnetIDs,omitempty"`
	ENISecurityGroupID string                     `json:"eniSecurityGroupID,omitempty"`

	// CCE 支持集群 IP version: dual stack, ipv4 only, ipv6 only
	IPVersion ContainerNetworkIPType `json:"ipVersion,omitempty"` // if not set, set ipv4

	// LB Service 关联 BLB 所在子网, 目前只能为普通子网
	LBServiceVPCSubnetID string `json:"lbServiceVPCSubnetID,omitempty" valid:"Required"`

	// 指定 NodePort Service 的端口范围
	NodePortRangeMin int `json:"nodePortRangeMin,omitempty"`
	NodePortRangeMax int `json:"nodePortRangeMax,omitempty"`

	// 集群 PodIP CIDR, 在 kubenet 网络模式下有效
	ClusterPodCIDR     string `json:"clusterPodCIDR,omitempty"`
	ClusterPodCIDRIPv6 string `json:"clusterPodCIDRIPv6,omitempty"`

	// Service ClusterIP 的 CIDR
	ClusterIPServiceCIDR     string `json:"clusterIPServiceCIDR,omitempty"`
	ClusterIPServiceCIDRIPv6 string `json:"clusterIPServiceCIDRIPv6,omitempty"`

	// 每个 Node 上最大的 Pod 数, 限制 NodeCIDR 的分配
	MaxPodsPerNode int `json:"maxPodsPerNode,omitempty"` // If not set, MaxPodsPerNode = 128

	// KubeProxy 的模式: iptables 和 ipvs
	KubeProxyMode KubeProxyMode `json:"kubeProxyMode,omitempty"` // If not set, kubeProxyMode=ipvs
}

ContainerNetworkConfig defines the network config Some attrs have default value

type ContainerNetworkIPType

type ContainerNetworkIPType string

ContainerNetworkIPType - 容器 IP 类型

const (
	// ContainerNetworkIPTypeIPv4 - 容器网段 IPv4
	ContainerNetworkIPTypeIPv4 ContainerNetworkIPType = "ipv4"
	// ContainerNetworkIPTypeIPv6 - 容器网段 IPv6
	ContainerNetworkIPTypeIPv6 ContainerNetworkIPType = "ipv6"
	// ContainerNetworkIPTypeDualStack - 容器网段双栈
	ContainerNetworkIPTypeDualStack ContainerNetworkIPType = "dualStack"
)

type ContainerNetworkMode

type ContainerNetworkMode string

ContainerNetworkMode defines container config

const (
	// ContainerNetworkModeKubenet using kubenet
	ContainerNetworkModeKubenet ContainerNetworkMode = "kubenet"

	// ContainerNetworkModeVPCCNI using vpc-cni
	ContainerNetworkModeVPCCNI ContainerNetworkMode = "vpc-cni"

	// ContainerNetworkModeVPCRouteVeth using vpc route plus veth
	ContainerNetworkModeVPCRouteVeth ContainerNetworkMode = "vpc-route-veth"

	// ContainerNetworkModeVPCRouteIPVlan using vpc route plus ipvlan
	ContainerNetworkModeVPCRouteIPVlan ContainerNetworkMode = "vpc-route-ipvlan"

	// ContainerNetworkModeVPCRouteAutoDetect using vpc route and auto detects veth or ipvlan due to kernel version
	ContainerNetworkModeVPCRouteAutoDetect ContainerNetworkMode = "vpc-route-auto-detect"

	// ContainerNetworkModeVPCSecondaryIPVeth using vpc secondary ip plus veth
	ContainerNetworkModeVPCSecondaryIPVeth ContainerNetworkMode = "vpc-secondary-ip-veth"

	// ContainerNetworkModeVPCSecondaryIPIPVlan using vpc secondary ip plus ipvlan
	ContainerNetworkModeVPCSecondaryIPIPVlan ContainerNetworkMode = "vpc-secondary-ip-ipvlan"

	// ContainerNetworkModeVPCSecondaryIPAutoDetect using vpc secondary ip and auto detects veth or ipvlan due to kernel version
	ContainerNetworkModeVPCSecondaryIPAutoDetect ContainerNetworkMode = "vpc-secondary-ip-auto-detect"
)

type DeleteOption

type DeleteOption struct {
	MoveOut           bool `json:"moveOut,omitempty"`
	DeleteResource    bool `json:"deleteResource,omitempty"`
	DeleteCDSSnapshot bool `json:"deleteCDSSnapshot,omitempty"`
}

DeleteOption 删除节点选项

type DeployCustomConfig

type DeployCustomConfig struct {
	// Docker相关配置
	DockerConfig DockerConfig `json:"dockerConfig,omitempty"`

	// kubelet数据目录
	KubeletRootDir string `json:"kubeletRootDir,omitempty"`
	// 是否开启资源预留
	EnableResourceReserved bool `json:"EnableResourceReserved,omitempty"`
	// 资源预留配额,
	// key:value: cpu: 100m, memory: 1000Mi
	KubeReserved map[string]string `json:"kubeReserved,omitempty"`

	// 是否封锁节点
	EnableCordon bool `json:"enableCordon,omitempty"`

	// 部署前执行脚本, 前端 base64编码后传参
	PreUserScript string `json:"preUserScript,omitempty"`
	// 部署后执行脚本, 前端 base64编码后传参
	PostUserScript string `json:"postUserScript,omitempty"`
}

DeployCustomConfig - 部署自定义配置

type Direction

type Direction string
const (
	DirectionIngress Direction = "ingress"
	DirectionEgress  Direction = "egress"
)

type DockerConfig

type DockerConfig struct {
	DockerDataRoot     string   `json:"dockerDataRoot,omitempty"`     // 自定义 docker 数据目录
	RegistryMirrors    []string `json:"registryMirrors,omitempty"`    // 自定义 RegistryMirrors
	InsecureRegistries []string `json:"insecureRegistries,omitempty"` // 自定义 InsecureRegistries
	DockerLogMaxSize   string   `json:"dockerLogMaxSize,omitempty"`   // docker日志大小,default: 20m
	DockerLogMaxFile   string   `json:"dockerLogMaxFile,omitempty"`   // docker日志保留数,default: 10
	BIP                string   `json:"dockerBIP,omitempty"`          // docker0网桥网段, default: 169.254.30.1/28
}

DockerConfig docker相关配置

type EIPOption

type EIPOption struct {
	EIPName         string        `json:"eipName,omitempty"`
	EIPChargingType BillingMethod `json:"eipChargeType,omitempty"`
	EIPBandwidth    int           `json:"eipBandwidth,omitempty"`
}

EIPOption 定义 Instance EIP 相关配置

type EtherType

type EtherType string
const (
	EtherTypeIPv4 EtherType = "IPv4"
	EtherTypeIPv6 EtherType = "IPv6"
)

type ExistedOption

type ExistedOption struct {
	ExistedInstanceID string `json:"existedInstanceID,omitempty"`

	// nil 为默认: 重装系统
	Rebuild *bool `json:"rebuild,omitempty"`
}

ExistedOption 已有实例相关配置

type GPUType

type GPUType string

GPUType GPU 类型

const (
	// GPUTypeV100_32 NVIDIA Tesla V100-32G
	GPUTypeV100_32 GPUType = "V100-32"
	// GPUTypeV100_16 NVIDIA Tesla V100-16G
	GPUTypeV100_16 GPUType = "V100-16"
	// GPUTypeP40 P40 NVIDIA Tesla P40
	GPUTypeP40 GPUType = "P40"
	// GPUTypeP4 P4 NVIDIA Tesla P4
	GPUTypeP4 GPUType = "P4"
	// GPUTypeK40 K40 NVIDIA Tesla K40
	GPUTypeK40 GPUType = "K40"
	// GPUTypeDLCard NVIDIA 深度学习开发卡
	GPUTypeDLCard GPUType = "DLCard"
)

type InstanceGroupSpec

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

	ClusterID   string      `json:"clusterID,omitempty" `
	ClusterRole ClusterRole `json:"clusterRole,omitempty" `

	Selector *InstanceSelector `json:"selector" `

	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

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

type InstanceLabels

type InstanceLabels map[string]string

type InstanceOS

type InstanceOS struct {
	ImageType bccapi.ImageType `json:"imageType,omitempty"` // 镜像类型
	ImageName string           `json:"imageName,omitempty"` // 镜像名字: ubuntu-14.04.1-server-amd64-201506171832
	OSType    OSType           `json:"osType,omitempty"`    // e.g. linux
	OSName    OSName           `json:"osName,omitempty"`    // e.g. Ubuntu
	OSVersion string           `json:"osVersion,omitempty"` // e.g. 14.04.1 LTS
	OSArch    string           `json:"osArch,omitempty"`    // e.g. x86_64 (64bit)
	OSBuild   string           `json:"osBuild,omitempty"`   // e.g. 2015061700
}

InstanceOS defines the OS of BCC

type InstancePhase

type InstancePhase string

InstancePhase CCE InstancePhase

const (
	// InstancePhasePending 创建节点时默认状态
	InstancePhasePending InstancePhase = "pending"

	// InstancePhaseProvisioning IaaS 相关资源正在创建中
	InstancePhaseProvisioning InstancePhase = "provisioning"

	// InstancePhaseProvisioned IaaS 相关资源已经 Ready
	InstancePhaseProvisioned InstancePhase = "provisioned"

	// InstancePhaseRunning 节点运行正常
	InstancePhaseRunning InstancePhase = "running"

	// InstancePhaseCreateFailed 节点异常
	InstancePhaseCreateFailed InstancePhase = "create_failed"

	// InstancePhaseDeleting 节点正在删除
	InstancePhaseDeleting InstancePhase = "deleting"

	// InstancePhaseDeleted 节点删除完成
	InstancePhaseDeleted InstancePhase = "deleted"

	// InstancePhaseDeleteFailed 节点删除失败
	InstancePhaseDeleteFailed InstancePhase = "delete_failed"
)

type InstancePreChargingOption

type InstancePreChargingOption struct {
	PurchaseTime      int    `json:"purchaseTime,omitempty"`      //  预付费才生效:单位月,12 = 12 月
	AutoRenew         bool   `json:"autoRenew,omitempty"`         // 是否自动续费
	AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"` // 续费单位:月
	AutoRenewTime     int    `json:"autoRenewTime,omitempty"`     // 12 = 12 个月
}

InstancePreChargingOption 定义付费相关配置

type InstanceResource

type InstanceResource struct {
	CPU int `json:"cpu,omitempty" valid:"Required"` // unit: Core
	MEM int `json:"mem,omitempty" valid:"Required"` // unit: GB

	// 使用BCI场景需要指定,节点本身的规格和node汇报规格不一致
	NodeCPUQuota int `json:"nodeCPUQuota,omitempty"` // unit: Core
	NodeMEMQuota int `json:"nodeMEMQuota,omitempty"` // unit: GB

	// RootDisk
	RootDiskType bccapi.StorageType `json:"rootDiskType,omitempty" valid:"Required"`
	RootDiskSize int                `json:"rootDiskSize,omitempty" valid:"Required"` // unit: GB

	// GPU 机器必须指定, 其他机器不用
	LocalDiskSize int `json:"localDiskSize,omitempty"` // unit: GB

	// CDS 列表, 默认第一块盘作为 docker 和 kubelet 数据盘
	CDSList CDSConfigList `json:"cdsList,omitempty"`

	// Only necessary when InstanceType = GPU
	GPUType  GPUType `json:"gpuType,omitempty"`
	GPUCount int     `json:"gpuCount,omitempty"`
}

InstanceResource 定义 Instance CPU/MEM/Disk 配置

type InstanceSelector

type InstanceSelector struct {
	LabelSelector `json:",inline"`
}

type InstanceSpec

type InstanceSpec struct {

	// 用于 CCE 唯一标识 Instance
	CCEInstanceID string `json:"cceInstanceID,omitempty"`
	InstanceName  string `json:"instanceName"`

	RuntimeType    RuntimeType `json:"runtimeType,omitempty"`
	RuntimeVersion string      `json:"runtimeVersion,omitempty"`

	ClusterID   string      `json:"clusterID,omitempty"`
	ClusterRole ClusterRole `json:"clusterRole,omitempty"`

	InstanceGroupID   string `json:"instanceGroupID,omitempty"`
	InstanceGroupName string `json:"instanceGroupName,omitempty"`

	// 初始化 DelProvider 使用
	MasterType MasterType `json:"masterType,omitempty"`

	// 是否为已有实例
	Existed       bool          `json:"existed,omitempty"`
	ExistedOption ExistedOption `json:"existedOption,omitempty"`

	// BCC, BBC, 裸金属
	MachineType MachineType `json:"machineType,omitempty" valid:"Required"`
	// 机器规格: 普通一, 普通二 ...
	InstanceType bccapi.InstanceType `json:"instanceType" valid:"Required"`
	// BBC 选项
	BBCOption BBCOption `json:"bbcOption,omitempty"`

	// VPC 相关配置
	VPCConfig `json:"vpcConfig,omitempty" valid:"Required"`

	// 集群规格相关配置
	InstanceResource `json:"instanceResource,omitempty" valid:"Required"`

	// 优先使用 ImageID, 如果用户传入 InstanceOS 信息, 由 service 计算 ImageID
	ImageID    string     `json:"imageID,omitempty"`
	InstanceOS InstanceOS `json:"instanceOS,omitempty"`

	// EIP
	NeedEIP   bool `json:"needEIP,omitempty"`
	EIPOption `json:"eipOption,omitempty"`

	// AdminPassword
	AdminPassword string `json:"adminPassword,omitempty" valid:"Required"`
	SSHKeyID      string `json:"sshKeyID,omitempty"`

	// Charging Type, 通常只支持后付费
	InstanceChargingType      bccapi.PaymentTimingType `json:"instanceChargingType,omitempty"` // 后付费或预付费
	InstancePreChargingOption `json:"instancePreChargingOption,omitempty"`

	// 删除节点选项
	DeleteOption DeleteOption `json:"deleteOption,omitempty"`

	DeployCustomConfig DeployCustomConfig `json:"deployCustomConfig,omitempty"` // 部署相关高级配置

	Tags TagList `json:"tags,omitempty"`

	Labels InstanceLabels `json:"labels,omitempty"`
	Taints InstanceTaints `json:"taints,omitempty"`
}

作为sdk创建节点时输入参数的InstanceSpec 已有节点需要用户提供:ClusterRole 、短ID,密码,镜像ID,镜像类型, docker storage(可选); BBC要额外加preservedData、raidId、sysRootSize

type InstanceStatus

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

	InstancePhase InstancePhase `json:"instancePhase,omitempty"`
}

type InstanceTaints

type InstanceTaints []Taint

type InstanceTemplate

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

type K8SCustomConfig

type K8SCustomConfig struct {
	MasterFeatureGates  map[string]bool `json:"masterFeatureGates,omitempty"`  // 自定义 FeatureGates
	NodeFeatureGates    map[string]bool `json:"nodeFeatureGates,omitempty"`    // 自定义 FeatureGates
	AdmissionPlugins    []string        `json:"admissionPlugins,omitempty"`    // 自定义 AdmissionPlugins
	PauseImage          string          `json:"pauseImage,omitempty"`          // 自定义 PauseImage
	KubeAPIQPS          int             `json:"kubeAPIQPS,omitempty"`          // 自定义 KubeAPIQPS
	KubeAPIBurst        int             `json:"kubeAPIBurst,omitempty"`        // 自定义 KubeAPIBurst
	SchedulerPredicates []string        `json:"schedulerPredicates,omitempty"` // 自定义 SchedulerPredicates
	SchedulerPriorities map[string]int  `json:"schedulerPriorities,omitempty"` // 自定义 SchedulerPriorities
	ETCDDataPath        string          `json:"etcdDataPath,omitempty"`        // 自定义 etcd数据目录
}

K8SCustomConfig - K8S 自定义配置

type K8SVersion

type K8SVersion string

K8SVersion defines the k8stypes version of cluster

const (
	//1.6和1.8不再支持,扩缩容需要联系CCE人员手动操作
	//K8S_1_6_2   K8SVersion = "1.6.2"
	//K8S_1_8_6   K8SVersion = "1.8.6"
	//K8S_1_8_12  K8SVersion = "1.8.12"
	//1.11.1 1.11.5 1.13.4仅支持已有集群扩容节点,不支持新创建集群
	//K8S_1_11_1  K8SVersion = "1.11.1"
	//K8S_1_11_5  K8SVersion = "1.11.5"
	//K8S_1_13_4  K8SVersion = "1.13.4"
	//支持在console创建集群
	K8S_1_13_10 K8SVersion = "1.13.10"
	//K8S_1_16_3  K8SVersion = "1.16.3"
	K8S_1_16_8 K8SVersion = "1.16.8"
)

type KubeProxyMode

type KubeProxyMode string

KubeProxyMode defines kube-proxy --proxy-mode If not set, using KubeProxyModeIPVS as default

const (
	// KubeProxyModeIPVS --proxy-mode=ipvs
	KubeProxyModeIPVS KubeProxyMode = "ipvs"

	// KubeProxyModeIptables --proxy-mode=iptables
	KubeProxyModeIptables KubeProxyMode = "iptables"
)

type LabelSelector

type LabelSelector struct {
	MatchLabels      map[string]string          `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"`
	MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"`
}

type LabelSelectorOperator

type LabelSelectorOperator string
const (
	LabelSelectorOpIn           LabelSelectorOperator = "In"
	LabelSelectorOpNotIn        LabelSelectorOperator = "NotIn"
	LabelSelectorOpExists       LabelSelectorOperator = "Exists"
	LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist"
)

type LabelSelectorRequirement

type LabelSelectorRequirement struct {
	Key      string                `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
	Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"`
	Values   []string              `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
}

type Machine

type Machine struct {
	// InstanceID for OpenAPI public
	InstanceID string `json:"instanceID,omitempty"`

	MachineStatus ServerStatus `json:"machineStatus,omitempty"`

	// 订单号
	OrderID string `json:"orderID,omitempty"`

	DCC   bool   `json:"dcc,omitempty"`
	DCCID string `json:"dccID,omitempty"`

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

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

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

Machine 定义创建完 IaaS 资源(BCC, BBC) 后, 才能获取信息

type MachineType

type MachineType string

MachineType 机器类型: BCC, BBC

const (
	// MachineTypeBCC 机器类型 BCC
	MachineTypeBCC MachineType = "BCC"

	// MachineTypeBBC 机器类型 BBC
	MachineTypeBBC MachineType = "BBC"

	// MachineTypeMetal 机器类型 裸金属
	MachineTypeMetal MachineType = "Metal"
)

type ManagedClusterMasterOption

type ManagedClusterMasterOption struct {
	MasterVPCSubnetZone AvailableZone `json:"masterVPCSubnetZone,omitempty"`
}

ManagedClusterMasterOption 托管集群 Master 配置

type MasterConfig

type MasterConfig struct {
	// MasterTypes: 托管, 自定义, 已有 BCC, 已有 BBC
	MasterType MasterType `json:"masterType,omitempty"`

	// ClusterHA 对 3 种集群都有效: 对于 Custom 和 Existed 作为校验和展示作用
	ClusterHA ClusterHA `json:"clusterHA,omitempty"`

	ExposedPublic bool `json:"exposedPublic,omitempty"`

	ClusterBLBVPCSubnetID string `json:"clusterBLBVPCSubnetID,omitempty"`

	ManagedClusterMasterOption `json:"managedClusterMasterOption,omitempty"`
}

MasterConfig Master 配置

type MasterType

type MasterType string

MasterType 定义 Master 机器来源

const (
	// MasterTypeManaged 托管 Master
	MasterTypeManaged MasterType = "managed"

	// MasterTypeCustom 自定义集群, 包含:
	// 1. 新建 BCC;
	// 2. 已有 BCC;
	// 3. 已有 BBC.
	MasterTypeCustom MasterType = "custom"

	// MasterTypeServerless Serverless集群Master
	MasterTypeServerless MasterType = "serverless"
)

type MountConfig

type MountConfig struct {
	Path        string             `json:"diskPath,omitempty"` // "/data"
	CDSID       string             `json:"cdsID,omitempty"`
	Device      string             `json:"device,omitempty"` // "/dev/vdb"
	CDSSize     int                `json:"cdsSize,omitempty"`
	StorageType bccapi.StorageType `json:"storageType,omitempty"`
}

MountConfig - 磁盘挂载信息

type OSName

type OSName string

OSName 操作系统名字

const (
	// OSNameCentOS centos
	OSNameCentOS OSName = "CentOS"
	// OSNameUbuntu ubuntu
	OSNameUbuntu OSName = "Ubuntu"
	// OSNameWindows windows
	OSNameWindows OSName = "Windows Server"
	// OSNameDebian debian
	OSNameDebian OSName = "Debian"
	// OSNameOpensuse opensuse
	OSNameOpensuse OSName = "opensuse"
)

type OSType

type OSType string

OSType 操作系统类型

const (
	// OSTypeLinux linux
	OSTypeLinux OSType = "linux"
	// OSTypeWindows windows
	OSTypeWindows OSType = "windows"
)

type PauseDetail

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

type PaymentTiming

type PaymentTiming string

PaymentTiming 付费时间选择

const (
	// PaymentTimingPrepaid 预付费
	PaymentTimingPrepaid PaymentTiming = "Prepaid"
	// PaymentTimingPostpaid 后付费
	PaymentTimingPostpaid PaymentTiming = "Postpaid"
)

type Protocol

type Protocol string
const (
	ProtocolAll  Protocol = "all"
	ProtocolTCP  Protocol = "tcp"
	ProtocolUDP  Protocol = "udp"
	ProtocolICMP Protocol = "icmp"
)

type Quota

type Quota struct {
	Quota int `json:"quota"`
	Used  int `json:"used"`
}

Quota - CCE Cluster/Node Quota

type RuntimeType

type RuntimeType string

RuntimeType defines the runtime on each node

const (
	RuntimeTypeDocker RuntimeType = "docker"
)

type SecurityGroupRule

type SecurityGroupRule struct {
	SecurityGroupID string    `json:"securityGroupId"`
	EtherType       EtherType `json:"ethertype"`
	Direction       Direction `json:"direction"`
	Protocol        Protocol  `json:"protocol"`
	SourceGroupID   string    `json:"sourceGroupId"`
	SourceIP        string    `json:"sourceIp"`
	DestGroupID     string    `json:"destGroupId"`
	DestIP          string    `json:"destIp"`
	PortRange       string    `json:"portRange"`
	Remark          string    `json:"remark"`
}

SecurityGroupRule 安全组规则

type ServerStatus

type ServerStatus string

ServerStatus BCC 虚机状态

const (
	// ServerStatusActive 虚机运行中
	ServerStatusActive ServerStatus = "ACTIVE"

	// ServerStatusBuild 虚机创建中
	ServerStatusBuild ServerStatus = "BUILD"

	// ServerStatusRebuild 虚机重装系统中
	ServerStatusRebuild ServerStatus = "REBUILD"

	// ServerStatusDeleted 虚机已删除
	ServerStatusDeleted ServerStatus = "DELETED"

	// ServerStatusSnapshot 创建快照
	ServerStatusSnapshot ServerStatus = "SNAPSHOT"

	// ServerStatusDeleteSnapshot 删除快照
	ServerStatusDeleteSnapshot ServerStatus = "DELETE_SNAPSHOT"

	// ServerStatusVolumeResize VOLUME_RESIZE
	ServerStatusVolumeResize ServerStatus = "VOLUME_RESIZE"

	// ServerStatusError 虚机异常
	ServerStatusError ServerStatus = "ERROR"

	// ServerStatusExpired 虚机欠费释放
	ServerStatusExpired ServerStatus = "EXPIRED"

	// ServerStatusReboot 虚机重启
	ServerStatusReboot ServerStatus = "REBOOT"

	// ServerStatusRecharge 虚机续费
	ServerStatusRecharge ServerStatus = "RECHARGE"

	// ServerStatusShutoff 虚机关机
	ServerStatusShutoff ServerStatus = "SHUTOFF"

	// ServerStatusStopped 虚机关机
	ServerStatusStopped ServerStatus = "STOPPED"

	// ServerStatusUnknown 虚机状态未知
	ServerStatusUnknown ServerStatus = "UNKNOWN"
)

type ShrinkPolicy

type ShrinkPolicy string

type Tag

type Tag struct {
	TagKey   string `json:"tagKey"`
	TagValue string `json:"tagValue"`
}

Tag represents TagModel in BCE

type TagList

type TagList []Tag

type Taint

type Taint struct {
	// Required. The taint key to be applied to a node.
	Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
	// Required. The taint value corresponding to the taint key.
	// +optional
	Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
	// Required. The effect of the taint on pods
	// that do not tolerate the taint.
	// Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
	Effect TaintEffect `json:"effect" protobuf:"bytes,3,opt,name=effect,casttype=TaintEffect"`
	// TimeAdded represents the time at which the taint was added.
	// It is only written for NoExecute taints.
	// +optional
	TimeAdded *Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"`
}

The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint.

type TaintEffect

type TaintEffect string
const (
	// Do not allow new pods to schedule onto the node unless they tolerate the taint,
	// but allow all pods submitted to Kubelet without going through the scheduler
	// to start, and allow all already-running pods to continue running.
	// Enforced by the scheduler.
	TaintEffectNoSchedule TaintEffect = "NoSchedule"

	// Like TaintEffectNoSchedule, but the scheduler tries not to schedule
	// new pods onto the node, rather than prohibiting new pods from scheduling
	// onto the node entirely. Enforced by the scheduler.
	TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule"

	// Evict any already-running pods that do not tolerate the taint.
	// Currently enforced by NodeController.
	TaintEffectNoExecute TaintEffect = "NoExecute"
)

type Time

type Time struct {
	time.Time `protobuf:"-"`
}

Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.

+protobuf.options.marshal=false +protobuf.as=Timestamp +protobuf.options.(gogoproto.goproto_stringer)=false

func Date

func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time

Date returns the Time corresponding to the supplied parameters by wrapping time.Date.

func NewTime

func NewTime(time time.Time) Time

NewTime returns a wrapped instance of the provided time

func Now

func Now() Time

Now returns the current local time.

func Unix

func Unix(sec int64, nsec int64) Time

Unix returns the local time corresponding to the given Unix time by wrapping time.Unix.

func (*Time) Before

func (t *Time) Before(u *Time) bool

Before reports whether the time instant t is before u.

func (*Time) DeepCopyInto

func (t *Time) DeepCopyInto(out *Time)

DeepCopyInto creates a deep-copy of the Time value. The underlying time.Time type is effectively immutable in the time API, so it is safe to copy-by-assign, despite the presence of (unexported) Pointer fields.

func (*Time) Equal

func (t *Time) Equal(u *Time) bool

Equal reports whether the time instant t is equal to u.

func (*Time) IsZero

func (t *Time) IsZero() bool

IsZero returns true if the value is nil or time is zero.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Time) MarshalQueryParameter

func (t Time) MarshalQueryParameter() (string, error)

MarshalQueryParameter converts to a URL query parameter value

func (Time) OpenAPISchemaFormat

func (_ Time) OpenAPISchemaFormat() string

OpenAPISchemaFormat is used by the kube-openapi generator when constructing the OpenAPI spec of this type.

func (Time) OpenAPISchemaType

func (_ Time) OpenAPISchemaType() []string

OpenAPISchemaType is used by the kube-openapi generator when constructing the OpenAPI spec of this type.

See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators

func (Time) Rfc3339Copy

func (t Time) Rfc3339Copy() Time

Rfc3339Copy returns a copy of the Time at second-level precision.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

func (*Time) UnmarshalQueryParameter

func (t *Time) UnmarshalQueryParameter(str string) error

UnmarshalQueryParameter converts from a URL query parameter value to an object

type UndeliveredMachines

type UndeliveredMachines struct {
	FailedMachines  []string `json:"failedMachines,omitempty"`
	PendingMachines []string `json:"pendingMachines,omitempty"`
}

type UpdatePolicy

type UpdatePolicy string

type VPCConfig

type VPCConfig struct {
	VPCID           string `json:"vpcID,omitempty" valid:"Required"`
	VPCSubnetID     string `json:"vpcSubnetID,omitempty" valid:"Required"`
	SecurityGroupID string `json:"securityGroupID,omitempty" valid:"Required"`

	VPCSubnetType     vpc.SubnetType `json:"vpcSubnetType,omitempty"`
	VPCSubnetCIDR     string         `json:"vpcSubnetCIDR,omitempty"`
	VPCSubnetCIDRIPv6 string         `json:"vpcSubnetCIDRIPv6,omitempty"`

	AvailableZone AvailableZone `json:"availableZone,omitempty"`
}

VPCConfig 定义 Instance VPC

Jump to

Keyboard shortcuts

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