Documentation ¶
Index ¶
- Constants
- func PrintNoReadyInfo()
- type BcsLaunchParam
- type BcsVolume
- type Endpoint
- type InstanceFilterFunction
- type NodeInfo
- type NodeInfoBlock
- type NodeInfoPool
- func (nip *NodeInfoPool) GetDetail() []*rsc.RscDetails
- func (nip *NodeInfoPool) GetFreeInstances(condition map[string]string, function InstanceFilterFunction, caller string) (int, string, error)
- func (nip *NodeInfoPool) GetLastUpdateTime() time.Time
- func (nip *NodeInfoPool) GetStats() string
- func (nip *NodeInfoPool) RecoverNoReadyBlock(key string, noReady int, caller string)
- func (nip *NodeInfoPool) ReleaseNoReadyInstance(key string, instance int, caller string)
- func (nip *NodeInfoPool) UpdateResources(nodeInfoList []*NodeInfo)
- type Operator
- type ServiceInfo
- type ServiceStatus
Constants ¶
const ( AttributeKeyCity = "City" AttributeKeyPlatform = "Platform" )
Variables ¶
This section is empty.
Functions ¶
func PrintNoReadyInfo ¶
func PrintNoReadyInfo()
Types ¶
type BcsLaunchParam ¶
type BcsLaunchParam struct { // application name Name string // application namespace Namespace string // attribute condition, matters the constraint strategy AttributeCondition map[string]string // env key-values which will be inserted into containers Env map[string]string // ports that implements with port_name:protocol // such as my_port_alpha:http, my_port_beta:tcp // port numbers are all generated by container scheduler with cnm HOST Ports map[string]string // volumes implements the hostPath volumes with name:settings Volumes map[string]BcsVolume // container images Image string // instance number to launch Instance int }
BcsLaunchParam describe the launch request param through bcs including mesos/k8s/devcloud-mac
func (*BcsLaunchParam) CheckQueueKey ¶
func (param *BcsLaunchParam) CheckQueueKey(instanceType config.InstanceType) bool
CheckQueueKey describe the function that get queue key from attributes
type InstanceFilterFunction ¶
InstanceFilterFunction describe the function that decide how many instance to launch/scale.
type NodeInfo ¶
type NodeInfo struct { IP string Hostname string DiskTotal float64 MemTotal float64 CPUTotal float64 DiskUsed float64 MemUsed float64 CPUUsed float64 DiskLeft float64 MemLeft float64 CPULeft float64 Attributes map[string]string Disabled bool }
NodeInfo 描述了从各个operator处获取的集群单个节点信息, 用于获取节点的标签, 资源使用情况等
func (*NodeInfo) FigureAvailableInstanceFromFree ¶
type NodeInfoBlock ¶
type NodeInfoBlock struct { DiskTotal float64 MemTotal float64 CPUTotal float64 DiskUsed float64 MemUsed float64 CPUUsed float64 DiskLeft float64 MemLeft float64 CPULeft float64 CPUPerInstance float64 MemPerInstance float64 CPUPerInstanceOffset float64 MemPerInstanceOffset float64 AvailableInstance int // contains filtered or unexported fields }
NodeInfoBlock 描述了一个特定区域的资源信息, 通常由多个区域组成一个完整的资源池NodeInfoPool 例如 shenzhen区, shanghai区, projectA区等等, 同一个NodeInfoBlock内的资源是统一处理的, 拥有共同的noReady计数
type NodeInfoPool ¶
NodeInfoPool 描述了一个节点集合的资源情况, 一般用来管理整个集群的资源情况
func NewNodeInfoPool ¶
func NewNodeInfoPool(conf *config.ContainerResourceConfig) *NodeInfoPool
NewNodeInfoPool get a new node info pool
func (*NodeInfoPool) GetDetail ¶
func (nip *NodeInfoPool) GetDetail() []*rsc.RscDetails
GetDetail get detail data
func (*NodeInfoPool) GetFreeInstances ¶
func (nip *NodeInfoPool) GetFreeInstances( condition map[string]string, function InstanceFilterFunction, caller string) (int, string, error)
GetFreeInstances 在资源池中尝试获取可用的instance, 给定需求条件condition和资源数量函数function
func (*NodeInfoPool) GetLastUpdateTime ¶
func (nip *NodeInfoPool) GetLastUpdateTime() time.Time
GetLastUpdateTime 获取上次资源数据更新的时间
func (*NodeInfoPool) GetStats ¶
func (nip *NodeInfoPool) GetStats() string
GetStats get status message
func (*NodeInfoPool) RecoverNoReadyBlock ¶
func (nip *NodeInfoPool) RecoverNoReadyBlock(key string, noReady int, caller string)
RecoverNoReadyBlock 对给定区域key的资源, 加上noReady个未就绪标记 一般用于在系统恢复时, 从数据库同步之前未就绪的数据信息
func (*NodeInfoPool) ReleaseNoReadyInstance ¶
func (nip *NodeInfoPool) ReleaseNoReadyInstance(key string, instance int, caller string)
ReleaseNoReadyInstance 消除给定区域的noReady计数, 表示这部分已经ready或已经释放
func (*NodeInfoPool) UpdateResources ¶
func (nip *NodeInfoPool) UpdateResources(nodeInfoList []*NodeInfo)
UpdateResources 更新资源数据, 给定从operators获取的节点信息列表, 将其信息与当前的资源信息进行整合同步 - 已经消失的节点: 剔除 - 新出现的节点: 增加 - 更新的节点: 更新资源信息
type Operator ¶
type Operator interface { GetResource(clusterID string) ([]*NodeInfo, error) GetServerStatus(clusterID, namespace, name string) (*ServiceInfo, error) LaunchServer(clusterID string, param BcsLaunchParam) error ScaleServer(clusterID string, namespace, name string, instance int) error ReleaseServer(clusterID, namespace, name string) error }
Operator define a bcs handler to do all operations.
type ServiceInfo ¶
type ServiceInfo struct { Status ServiceStatus Message string RequestInstances int CurrentInstances int AvailableEndpoints []*Endpoint }
ServiceInfo 描述了已经消费了资源的服务信息
type ServiceStatus ¶
type ServiceStatus int
const ( // Container Service launched and not ready. ServiceStatusStaging ServiceStatus = iota // Container Service running successfully. ServiceStatusRunning // Container Service failed to be running. ServiceStatusFailed )
func (ServiceStatus) String ¶
func (ss ServiceStatus) String() string
String get service status string.