Documentation ¶
Index ¶
- Constants
- Variables
- type APIHostNode
- type AllocatedResources
- type ClusterClient
- type ConditionStatus
- type HostNode
- func (n *HostNode) Decode(data []byte) error
- func (n *HostNode) DeleteCondition(types ...NodeConditionType)
- func (n *HostNode) DeleteNode() (*client.DeleteResponse, error)
- func (n *HostNode) GetCondition(ctype NodeConditionType) *NodeCondition
- func (n *HostNode) String() string
- func (n *HostNode) UpdataCondition(conditions ...NodeCondition)
- func (n *HostNode) UpdataK8sCondition(conditions []v1.NodeCondition)
- func (n *HostNode) Update() (*client.PutResponse, error)
- func (n *HostNode) UpdateK8sNodeStatus(k8sNode v1.Node)
- func (n *HostNode) UpdateReadyStatus()
- type HostRule
- type NodeCondition
- type NodeConditionType
- type NodeList
- type NodePodResource
- type NodeStatus
- type NodeSystemInfo
- type Resource
Constants ¶
const ( //Running node running status Running = "running" //Offline node offline status Offline = "offline" //Unknown node unknown status Unknown = "unknown" //Error node error status Error = "error" //Init node init status Init = "init" //InstallSuccess node install success status InstallSuccess = "install_success" //InstallFailed node install failure status InstallFailed = "install_failed" //Installing node installing status Installing = "installing" //NotInstalled node not install status NotInstalled = "not_installed" )
Variables ¶
var ComputeNode = "compute"
ComputeNode 计算节点
var ErrorNotFound = fmt.Errorf("node not found")
ErrorNotFound node not found.
var LBNode = "loadbalance"
LBNode 边缘负载均衡节点
var LabelOS = "beta.kubernetes.io/os"
LabelOS node label about os
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|in:manage,compute,gateway"` PodCIDR string `json:"podCIDR"` AutoInstall bool `json:"auto_install"` Labels map[string]string `json:"labels"` }
APIHostNode api host node
type AllocatedResources ¶
type ClusterClient ¶
type ClusterClient interface { UpdateStatus(*HostNode, map[string]string) error DownNode(*HostNode) error GetMasters() ([]*HostNode, error) GetNode(nodeID string) (*HostNode, error) RegistNode(node *HostNode) error GetDataCenterConfig() (*config.DataCenterConfig, error) GetOptions() *option.Conf GetEndpoints(key string) []string SetEndpoints(key string, value []string) DelEndpoints(key string) }
ClusterClient ClusterClient
func NewClusterClient ¶
func NewClusterClient(conf *option.Conf) ClusterClient
NewClusterClient new cluster client
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,loadbalance Status string `json:"status"` Labels map[string]string `json:"labels"` //节点标签 内置标签+用户自定义标签 Unschedulable bool `json:"unschedulable"` //设置值 PodCIDR string `json:"podCIDR"` NodeStatus NodeStatus `json:"node_status"` }
HostNode rainbond node entity
func (*HostNode) DeleteCondition ¶
func (n *HostNode) DeleteCondition(types ...NodeConditionType)
DeleteCondition DeleteCondition
func (*HostNode) DeleteNode ¶
func (n *HostNode) DeleteNode() (*client.DeleteResponse, error)
DeleteNode delete node
func (*HostNode) GetCondition ¶
func (n *HostNode) GetCondition(ctype NodeConditionType) *NodeCondition
GetCondition get condition
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 (n *HostNode) Update() (*client.PutResponse, error)
Update update node info
func (*HostNode) UpdateK8sNodeStatus ¶
UpdateK8sNodeStatus update rainbond node status by k8s node
func (*HostNode) UpdateReadyStatus ¶
func (n *HostNode) UpdateReadyStatus()
UpdateReadyStatus UpdateReadyStatus
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" KubeNodeReady NodeConditionType = "KubeNodeReady" NodeUp NodeConditionType = "NodeUp" // 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" PIDPressure NodeConditionType = "PIDPressure" )
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 { //worker maintenance Version string `json:"version"` //worker maintenance example: unscheduler, offline //Initiate a recommendation operation to the master based on the node state AdviceAction []string `json:"advice_actions"` //worker maintenance Status string `json:"status"` //installed running offline unknown //master maintenance CurrentScheduleStatus bool `json:"current_scheduler"` //master maintenance NodeHealth bool `json:"node_health"` //worker maintenance NodeUpdateTime time.Time `json:"node_update_time"` //master maintenance KubeUpdateTime time.Time `json:"kube_update_time"` //worker maintenance node progress down time LastDownTime time.Time `json:"down_time"` //worker and master maintenance Conditions []NodeCondition `json:"conditions,omitempty"` //master maintenance KubeNode *v1.Node //worker and master maintenance 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"` NumCPU int64 `json:"cpu_num"` }
NodeSystemInfo is a set of ids/uuids to uniquely identify the node.