rainbond: github.com/goodrain/rainbond/node/nodem/client Index | Files

package client

import "github.com/goodrain/rainbond/node/nodem/client"

Index

Package Files

cluster_client.go node.go

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 GatewayNode = "gateway"

GatewayNode 边缘负载均衡节点

var LabelOS = "beta.kubernetes.io/os"

LabelOS node label about os

var ManageNode = "manage"

ManageNode 管理节点

var StorageNode = "storage"

StorageNode 存储节点

var SupportNodeRule = []string{ComputeNode, ManageNode, StorageNode, GatewayNode}

SupportNodeRule -

type APIHostNode Uses

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        HostRule          `json:"role" validate:"role|required"`
    PodCIDR     string            `json:"podCIDR"`
    AutoInstall bool              `json:"auto_install"`
    Labels      map[string]string `json:"labels"`
}

APIHostNode api host node

func (APIHostNode) Clone Uses

func (a APIHostNode) Clone() *HostNode

Clone Clone

type AllocatedResources Uses

type AllocatedResources struct {
    CPURequests     int64
    CPULimits       int64
    MemoryRequests  int64
    MemoryLimits    int64
    MemoryRequestsR string
    MemoryLimitsR   string
    CPURequestsR    string
    CPULimitsR      string
}

type ClusterClient Uses

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 Uses

func NewClusterClient(conf *option.Conf) ClusterClient

NewClusterClient new cluster client

type ConditionStatus Uses

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 Uses

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, gateway
    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 GetNodeFromKV Uses

func GetNodeFromKV(kv *mvccpb.KeyValue) *HostNode

GetNodeFromKV 从etcd解析node信息

func (*HostNode) Decode Uses

func (n *HostNode) Decode(data []byte) error

Decode decode node info

func (*HostNode) DeleteCondition Uses

func (n *HostNode) DeleteCondition(types ...NodeConditionType)

DeleteCondition DeleteCondition

func (*HostNode) DeleteNode Uses

func (n *HostNode) DeleteNode() (*client.DeleteResponse, error)

DeleteNode delete node

func (*HostNode) GetCondition Uses

func (n *HostNode) GetCondition(ctype NodeConditionType) *NodeCondition

GetCondition get condition

func (*HostNode) String Uses

func (n *HostNode) String() string

String string

func (*HostNode) UpdataCondition Uses

func (n *HostNode) UpdataCondition(conditions ...NodeCondition)

UpdataCondition 更新状态

func (*HostNode) UpdataK8sCondition Uses

func (n *HostNode) UpdataK8sCondition(conditions []v1.NodeCondition)

UpdataK8sCondition 更新k8s节点的状态到rainbond节点

func (*HostNode) Update Uses

func (n *HostNode) Update() (*client.PutResponse, error)

Update update node info

func (*HostNode) UpdateK8sNodeStatus Uses

func (n *HostNode) UpdateK8sNodeStatus(k8sNode v1.Node)

UpdateK8sNodeStatus update rainbond node status by k8s node

func (*HostNode) UpdateReadyStatus Uses

func (n *HostNode) UpdateReadyStatus()

UpdateReadyStatus UpdateReadyStatus

type HostRule Uses

type HostRule []string

HostRule 节点角色

func (*HostRule) Add Uses

func (h *HostRule) Add(role ...string)

Add add role

func (HostRule) HasRule Uses

func (h HostRule) HasRule(rule string) bool

HasRule 是否具有什么角色

func (HostRule) String Uses

func (h HostRule) String() string

func (HostRule) Validation Uses

func (h HostRule) Validation() error

Validation host rule validation

type NodeCondition Uses

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 Uses

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 Uses

func (nt NodeConditionType) Compare(ent NodeConditionType) bool

Compare 比较

type NodeList Uses

type NodeList []*HostNode

NodeList node list

func (NodeList) Len Uses

func (list NodeList) Len() int

func (NodeList) Less Uses

func (list NodeList) Less(i, j int) bool

func (NodeList) Swap Uses

func (list NodeList) Swap(i, j int)

type NodePodResource Uses

type NodePodResource struct {
    AllocatedResources `json:"allocatedresources"`
    Resource           `json:"allocatable"`
}

type NodeStatus Uses

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 Uses

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.

type Resource Uses

type Resource struct {
    CpuR int `json:"cpu"`
    MemR int `json:"mem"`
}

Resource 资源

Package client imports 16 packages (graph) and is imported by 16 packages. Updated 2019-07-22. Refresh now. Tools for package owners.