node

package
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocatable

type Allocatable struct {
	NodeName   string    `json:"node_name"`
	Cpu        float64   `json:"cpu"`
	Disk       uint64    `json:"disk"`
	Memory     uint64    `json:"memory"`
	UpdateTime time.Time `json:"update_time"`
}

Allocatable available resources for node

func NewAllocatable added in v1.1.3

func NewAllocatable(nodeName string) *Allocatable

NewAllocatable returns a new *Allocatable

type AllocatableOption

type AllocatableOption func(a *Allocatable)

AllocatableOption Allocatable's options

type Capacity

type Capacity struct {
	NodeName    string       `json:"node_name"`
	Cpu         float64      `json:"cpu"`
	Disk        uint64       `json:"disk"`
	Memory      uint64       `json:"memory"` //byte
	CpuCors     int32        `json:"cpu_cores"`
	CpuUsage    uint8        `json:"cpu_usage"`
	MemoryUsage uint8        `json:"memory_usage"`
	UpdateTime  time.Time    `json:"update_time"`
	Allocatable *Allocatable `json:"allocatable"`
}

Capacity node capacity

func NewCapacity added in v1.1.3

func NewCapacity(nodeName string) *Capacity

New returns a new *Capacity

type CapacityOption

type CapacityOption func(c *Capacity)

CapacityOption sets Capacity

type Condition

type Condition struct {
}

type Node

type Node struct {
	Name       string    `json:"name"`
	Role       Role      `json:"role"`
	IP         net.IP    `json:"ip"`
	Version    string    `json:"version"`
	CreateTime time.Time `json:"create_time"`
}

Node is node

func NewNode added in v1.1.3

func NewNode(name string) *Node

NewNode returns a new node

func (*Node) Key

func (s *Node) Key() (key string)

Key generate etcd key

func (*Node) Unmarshal

func (s *Node) Unmarshal(val []byte) (err error)

Unmarshal generate from json data

func (*Node) Val

func (s *Node) Val() (val string)

Val generate etcd val

type NodeOption

type NodeOption func(s *Node)

NodeOption configure node

func WithNodeIP

func WithNodeIP(i net.IP) NodeOption

WithNodeIP sets node's ip

func WithNodeVersion

func WithNodeVersion(v string) NodeOption

WithNodeVersion sets node's version

type Role

type Role struct {
	Master bool `json:"master"`
	Admin  bool `json:"admin"`
	Worker bool `json:"worker"`
}

Role store struct

type Status

type Status struct {
	NodeName           string `json:"node_name"`
	Ready              bool   `json:"ready"`
	NetworkUnavailable bool   `json:"network_unavailable"`
	MemoryPressure     bool   `json:"memory_pressure"`
	DiskPressure       bool   `json:"disk_pressure"`
	CPUPressure        bool   `json:"cpu_pressure"`
}

Status node status

func New added in v1.1.3

func New(nodeName string) (s *Status)

New returns a status model

type StatusOption

type StatusOption func(s *Status)

StatusOption is function configure Status

func WithCPUPressure

func WithCPUPressure(b bool) StatusOption

WithCPUPressure sets status cpu

func WithDiskPressure

func WithDiskPressure(b bool) StatusOption

WithDiskPressure sets status disk

func WithMemoryPressure

func WithMemoryPressure(b bool) StatusOption

WithMemoryPressure sets status memory

func WithNetworkUnavailable

func WithNetworkUnavailable(b bool) StatusOption

WithNetworkUnavailable sets status network

func WithReady

func WithReady(b bool) StatusOption

WithReady sets status ready

Jump to

Keyboard shortcuts

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