Documentation ¶
Index ¶
- Variables
- type APIHostNode
- type AllocatedResources
- type ClusterClient
- type ClusterNode
- type ConditionStatus
- type HostNode
- func (n *HostNode) Decode(data []byte) error
- func (h *HostNode) Del() (*client.DeleteResponse, error)
- func (n *HostNode) DeleteCondition(types ...NodeConditionType)
- func (h *HostNode) DeleteNode() (*client.DeleteResponse, error)
- func (h *HostNode) Down()
- func (h *HostNode) Put(opts ...client.OpOption) (*client.PutResponse, error)
- func (h *HostNode) String() string
- func (n *HostNode) UpdataCondition(conditions ...NodeCondition)
- func (n *HostNode) UpdataK8sCondition(conditions []v1.NodeCondition)
- func (h *HostNode) Update() (*client.PutResponse, error)
- func (n *HostNode) UpdateK8sNodeStatus(k8sNode v1.Node)
- type HostRule
- type NodeCondition
- type NodeConditionType
- type NodeList
- type NodePodResource
- type NodeStatus
- type NodeSystemInfo
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ComputeNode = "compute"
ComputeNode 计算节点
var LBNode = "lb"
LBNode 边缘负载均衡节点
var ManageNode = "manage"
ManageNode 管理节点
var StorageNode = "storage"
StorageNode 存储节点
Functions ¶
This section is empty.
Types ¶
type APIHostNode ¶
type APIHostNode struct { ID string `json:"uuid" validate:"uuid"` HostName string `json:"host_name" validate:"host_name"` InternalIP string `json:"internal_ip" validate:"internal_ip|ip"` ExternalIP string `json:"external_ip" validate:"external_ip|ip"` RootPass string `json:"root_pass,omitempty"` Privatekey string `json:"private_key,omitempty"` Role string `json:"role" validate:"role|required"` Labels map[string]string `json:"labels"` }
APIHostNode api host node
type AllocatedResources ¶
type ClusterClient ¶
type ClusterClient interface { UpdateStatus(*HostNode) error DownNode(*HostNode) error GetMasters() ([]*HostNode, error) GetNode(nodeID string) (*HostNode, error) GetDataCenterConfig() (*config.DataCenterConfig, error) GetOptions() *option.Conf GetEndpoints(key string) []string SetEndpoints(key string, value []string) WatchJobs() <-chan *job.Event }
ClusterClient ClusterClient
func NewClusterClient ¶
func NewClusterClient(conf *option.Conf, etcdClient *clientv3.Client) ClusterClient
NewClusterClient new cluster client
type ClusterNode ¶
type ClusterNode struct { PID string `json:"pid"` // 进程 pid Version string `json:"version"` UpTime time.Time `json:"up"` // 启动时间 DownTime time.Time `json:"down"` // 上次关闭时间 Alived bool `json:"alived"` // 是否可用 Connected bool `json:"connected"` // 当 Alived 为 true 时有效,表示心跳是否正常 }
ClusterNode 集群节点实体
type ConditionStatus ¶
type ConditionStatus string
ConditionStatus ConditionStatus
const ( ConditionTrue ConditionStatus = "True" ConditionFalse ConditionStatus = "False" ConditionUnknown ConditionStatus = "Unknown" )
These are valid condition statuses. "ConditionTrue" means a resource is in the condition. "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes can't decide if a resource is in the condition or not. In the future, we could add other intermediate conditions, e.g. ConditionDegraded.
type HostNode ¶
type HostNode struct { ID string `json:"uuid"` HostName string `json:"host_name"` CreateTime time.Time `json:"create_time"` InternalIP string `json:"internal_ip"` ExternalIP string `json:"external_ip"` RootPass string `json:"root_pass,omitempty"` KeyPath string `json:"key_path,omitempty"` //管理节点key文件路径 AvailableMemory int64 `json:"available_memory"` AvailableCPU int64 `json:"available_cpu"` Mode string `json:"mode"` Role HostRule `json:"role"` //节点属性 compute manage storage Status string `json:"status"` //节点状态 create,init,running,stop,delete Labels map[string]string `json:"labels"` //节点标签 内置标签+用户自定义标签 Unschedulable bool `json:"unschedulable"` //不可调度 NodeStatus *NodeStatus `json:"node_status,omitempty"` ClusterNode }
HostNode rainbond node entity
func (*HostNode) DeleteCondition ¶
func (n *HostNode) DeleteCondition(types ...NodeConditionType)
DeleteCondition DeleteCondition
func (*HostNode) DeleteNode ¶
func (h *HostNode) DeleteNode() (*client.DeleteResponse, error)
DeleteNode 删除节点
func (*HostNode) UpdataCondition ¶
func (n *HostNode) UpdataCondition(conditions ...NodeCondition)
UpdataCondition 更新状态
func (*HostNode) UpdataK8sCondition ¶
func (n *HostNode) UpdataK8sCondition(conditions []v1.NodeCondition)
UpdataK8sCondition 更新k8s节点的状态到rainbond节点
func (*HostNode) Update ¶
func (h *HostNode) Update() (*client.PutResponse, error)
Update 更新节点信息,由节点启动时调用
func (*HostNode) UpdateK8sNodeStatus ¶
UpdateK8sNodeStatus update rainbond node status by k8s node
type NodeCondition ¶
type NodeCondition struct { // Type of node condition. Type NodeConditionType `json:"type" ` // Status of the condition, one of True, False, Unknown. Status ConditionStatus `json:"status" ` // Last time we got an update on a given condition. // +optional LastHeartbeatTime time.Time `json:"lastHeartbeatTime,omitempty" ` // Last time the condition transit from one status to another. // +optional LastTransitionTime time.Time `json:"lastTransitionTime,omitempty" ` // (brief) reason for the condition's last transition. // +optional Reason string `json:"reason,omitempty"` // Human readable message indicating details about last transition. // +optional Message string `json:"message,omitempty"` }
NodeCondition contains condition information for a node.
type NodeConditionType ¶
type NodeConditionType string
NodeConditionType NodeConditionType
const ( // NodeReady means this node is working NodeReady NodeConditionType = "Ready" // InstallNotReady means the installation task was not completed in this node. InstallNotReady NodeConditionType = "InstallNotReady" // NodeInit means node already install rainbond node and regist NodeInit NodeConditionType = "NodeInit" OutOfDisk NodeConditionType = "OutOfDisk" MemoryPressure NodeConditionType = "MemoryPressure" DiskPressure NodeConditionType = "DiskPressure" )
These are valid conditions of node.
func (NodeConditionType) Compare ¶
func (nt NodeConditionType) Compare(ent NodeConditionType) bool
Compare 比较
type NodePodResource ¶
type NodePodResource struct { AllocatedResources `json:"allocatedresources"` Resource `json:"allocatable"` }
type NodeStatus ¶
type NodeStatus struct { Status string `json:"status"` //installed running offline unknown Conditions []NodeCondition `json:"conditions,omitempty"` NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" protobuf:"bytes,7,opt,name=nodeInfo"` }
NodeStatus node status
type NodeSystemInfo ¶
type NodeSystemInfo struct { // MachineID reported by the node. For unique machine identification // in the cluster this field is preferred. Learn more from man(5) // machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html MachineID string `json:"machineID"` // SystemUUID reported by the node. For unique machine identification // MachineID is preferred. This field is specific to Red Hat hosts // https://access.redhat.com/documentation/en-US/Red_Hat_Subscription_Management/1/html/RHSM/getting-system-uuid.html SystemUUID string `json:"systemUUID"` // Boot ID reported by the node. BootID string `json:"bootID" protobuf:"bytes,3,opt,name=bootID"` // Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). KernelVersion string `json:"kernelVersion" ` // OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). OSImage string `json:"osImage"` // ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0). ContainerRuntimeVersion string `json:"containerRuntimeVersion"` // The Operating System reported by the node OperatingSystem string `json:"operatingSystem"` // The Architecture reported by the node Architecture string `json:"architecture"` MemorySize uint64 `json:"memorySize"` }
NodeSystemInfo is a set of ids/uuids to uniquely identify the node.