Documentation ¶
Index ¶
- Variables
- func DropNode(nodename string)
- func InitData()
- type ArbitratorStatus
- type Config
- type Data
- type DataElement
- type Dataer
- type Gen
- type Instances
- type Labels
- type Monitor
- type MonitorGlobalExpect
- type MonitorLocalExpect
- type MonitorState
- type MonitorUpdate
- type Node
- type NodeInfo
- type NodesInfo
- type Os
- type Stats
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( MonitorStateStrings = map[MonitorState]string{ MonitorStateDraining: "draining", MonitorStateDrainFailed: "drain failed", MonitorStateDrained: "drained", MonitorStateIdle: "idle", MonitorStateThawedFailed: "unfreeze failed", MonitorStateFreezeFailed: "freeze failed", MonitorStateFreezing: "freezing", MonitorStateFrozen: "frozen", MonitorStateThawing: "thawing", MonitorStateShutdown: "shutdown", MonitorStateShutdownFailed: "shutdown failed", MonitorStateShutting: "shutting", MonitorStateMaintenance: "maintenance", MonitorStateInit: "init", MonitorStateUpgrade: "upgrade", MonitorStateRejoin: "rejoin", } MonitorStateValues = map[string]MonitorState{ "drained": MonitorStateDrained, "draining": MonitorStateDraining, "drain failed": MonitorStateDrainFailed, "idle": MonitorStateIdle, "unfreeze failed": MonitorStateThawedFailed, "freeze failed": MonitorStateFreezeFailed, "freezing": MonitorStateFreezing, "frozen": MonitorStateFrozen, "thawing": MonitorStateThawing, "shutdown": MonitorStateShutdown, "shutdown failed": MonitorStateShutdownFailed, "shutting": MonitorStateShutting, "maintenance": MonitorStateMaintenance, "init": MonitorStateInit, "upgrade": MonitorStateUpgrade, "rejoin": MonitorStateRejoin, } MonitorLocalExpectStrings = map[MonitorLocalExpect]string{ MonitorLocalExpectInit: "init", MonitorLocalExpectDrained: "drained", MonitorLocalExpectNone: "none", } MonitorLocalExpectValues = map[string]MonitorLocalExpect{ "init": MonitorLocalExpectInit, "drained": MonitorLocalExpectDrained, "none": MonitorLocalExpectNone, } MonitorGlobalExpectStrings = map[MonitorGlobalExpect]string{ MonitorGlobalExpectAborted: "aborted", MonitorGlobalExpectFrozen: "frozen", MonitorGlobalExpectNone: "none", MonitorGlobalExpectThawed: "thawed", MonitorGlobalExpectInit: "init", } MonitorGlobalExpectValues = map[string]MonitorGlobalExpect{ "aborted": MonitorGlobalExpectAborted, "frozen": MonitorGlobalExpectFrozen, "none": MonitorGlobalExpectNone, "thawed": MonitorGlobalExpectThawed, "init": MonitorGlobalExpectInit, } // MonitorStateUnrankable is the node monitor states evicting a node from ranking algorithms MonitorStateUnrankable = map[MonitorState]any{ MonitorStateMaintenance: nil, MonitorStateUpgrade: nil, MonitorStateInit: nil, MonitorStateShutdown: nil, MonitorStateShutdownFailed: nil, MonitorStateShutting: nil, MonitorStateRejoin: nil, } ErrInvalidGlobalExpect = errors.New("invalid node monitor global expect") ErrInvalidLocalExpect = errors.New("invalid node monitor local expect") ErrInvalidState = errors.New("invalid node monitor state") ErrSameGlobalExpect = errors.New("node monitor global expect is already set to the same value") ErrSameLocalExpect = errors.New("node monitor local expect is already set to the same value") ErrSameState = errors.New("node monitor state is already set to the same value") )
Functions ¶
Types ¶
type ArbitratorStatus ¶
ArbitratorStatus describes the internet name of an arbitrator and if it is join-able.
type Config ¶
type Config struct { Env string `json:"env"` MaintenanceGracePeriod time.Duration `json:"maintenance_grace_period"` MaxParallel int `json:"max_parallel"` ReadyPeriod time.Duration `json:"ready_period"` RejoinGracePeriod time.Duration `json:"rejoin_grace_period"` SplitAction string `json:"split_action"` }
func (*Config) Unstructured ¶
type Data ¶
Data defines a shared holder for all nodes Dataer
var ( // ConfigData is the package data holder for all nodes Configs ConfigData *Data[Config] // MonitorData is the package data holder for all nodes Monitors MonitorData *Data[Monitor] // OsPathsData is the package data holder for all nodes Os paths data OsPathsData *Data[san.Paths] // StatsData is the package data holder for all nodes stats StatsData *Data[Stats] // StatusData is the package data holder for all nodes statuses StatusData *Data[Status] // GenData is the package data holder for all nodes statuses GenData *Data[Gen] )
func (*Data[T]) Get ¶
func (c *Data[T]) Get(nodename string) *T
Get return the stored value for nodename or nil if not found
func (*Data[T]) GetAll ¶
func (c *Data[T]) GetAll() []DataElement[T]
GetAll returns all stored elements as list of DataElement[T]
type DataElement ¶
type Instances ¶
type Instances struct { Config map[string]instance.Config `json:"config"` Status map[string]instance.Status `json:"status"` Monitor map[string]instance.Monitor `json:"monitor"` }
Instances groups instances configuration digest and status
type Monitor ¶
type Monitor struct { GlobalExpect MonitorGlobalExpect `json:"global_expect"` LocalExpect MonitorLocalExpect `json:"local_expect"` State MonitorState `json:"state"` GlobalExpectUpdatedAt time.Time `json:"global_expect_updated_at"` LocalExpectUpdatedAt time.Time `json:"local_expect_updated_at"` StateUpdatedAt time.Time `json:"state_updated_at"` UpdatedAt time.Time `json:"updated_at"` OrchestrationID uuid.UUID `json:"orchestration_id"` OrchestrationIsDone bool `json:"orchestration_is_done"` SessionID uuid.UUID `json:"session_id"` IsPreserved bool `json:"preserved"` }
Monitor describes the in-daemon states of a node
func (*Monitor) Unstructured ¶
type MonitorGlobalExpect ¶
type MonitorGlobalExpect int
const ( MonitorGlobalExpectInit MonitorGlobalExpect = iota MonitorGlobalExpectAborted MonitorGlobalExpectFrozen MonitorGlobalExpectNone MonitorGlobalExpectThawed )
func (MonitorGlobalExpect) MarshalText ¶
func (t MonitorGlobalExpect) MarshalText() ([]byte, error)
func (MonitorGlobalExpect) String ¶
func (t MonitorGlobalExpect) String() string
func (*MonitorGlobalExpect) UnmarshalText ¶
func (t *MonitorGlobalExpect) UnmarshalText(b []byte) error
type MonitorLocalExpect ¶
type MonitorLocalExpect int
const ( MonitorLocalExpectInit MonitorLocalExpect = iota MonitorLocalExpectDrained MonitorLocalExpectNone )
func (MonitorLocalExpect) MarshalText ¶
func (t MonitorLocalExpect) MarshalText() ([]byte, error)
func (MonitorLocalExpect) String ¶
func (t MonitorLocalExpect) String() string
func (*MonitorLocalExpect) UnmarshalText ¶
func (t *MonitorLocalExpect) UnmarshalText(b []byte) error
type MonitorState ¶
type MonitorState int
const ( MonitorStateInit MonitorState = iota MonitorStateIdle MonitorStateDraining MonitorStateDrainFailed MonitorStateDrained MonitorStateThawedFailed MonitorStateFreezeFailed MonitorStateFreezing MonitorStateFrozen MonitorStateThawing // MonitorStateShutdown is the node monitor state on successfully shutdown MonitorStateShutdown // MonitorStateShutdownFailed is the node monitor state on failed shutdown MonitorStateShutdownFailed // MonitorStateShutting is the node monitor state during a shutdown in progress MonitorStateShutting MonitorStateMaintenance MonitorStateUpgrade MonitorStateRejoin )
func (MonitorState) IsDoing ¶
func (t MonitorState) IsDoing() bool
func (MonitorState) IsRankable ¶
func (t MonitorState) IsRankable() bool
func (MonitorState) MarshalText ¶
func (t MonitorState) MarshalText() ([]byte, error)
func (MonitorState) String ¶
func (t MonitorState) String() string
func (*MonitorState) UnmarshalText ¶
func (t *MonitorState) UnmarshalText(b []byte) error
type MonitorUpdate ¶
type MonitorUpdate struct { State *MonitorState `json:"state"` LocalExpect *MonitorLocalExpect `json:"local_expect"` GlobalExpect *MonitorGlobalExpect `json:"global_expect"` // CandidateOrchestrationID is a candidate orchestration id for a new imon orchestration. CandidateOrchestrationID uuid.UUID `json:"orchestration_id"` }
MonitorUpdate is embedded in the SetNodeMonitor message to change some Monitor values. A nil value does not change the current value.
func (MonitorUpdate) String ¶
func (t MonitorUpdate) String() string
type Node ¶
type Node struct { Instance map[string]instance.Instance `json:"instance"` Monitor Monitor `json:"monitor"` Stats Stats `json:"stats"` Status Status `json:"status"` Os Os `json:"os"` Config Config `json:"config"` Daemon daemonsubsystem.Daemon `json:"daemon"` }
Node holds a node DataSet.
type NodesInfo ¶
NodesInfo is the dataset exposed via the GET /nodes_info handler, used by nodes to: * expand node selector expressions based on labels * setup clusterwide lun mapping from pools backed by san arrays
func (NodesInfo) GetNodesWithAnyPaths ¶
GetNodesWithAnyPaths return the list of nodes having any of the given paths.
type Stats ¶
type Stats struct { Load15M float64 `json:"load_15m"` MemAvailPct uint64 `json:"mem_avail"` MemTotalMB uint64 `json:"mem_total"` Score uint64 `json:"score"` SwapAvailPct uint64 `json:"swap_avail"` SwapTotalMB uint64 `json:"swap_total"` }
Stats describes systems (cpu, mem, swap) resource usage of a node and an opensvc-specific score.
type Status ¶
type Status struct { Agent string `json:"agent"` API uint64 `json:"api"` Arbitrators map[string]ArbitratorStatus `json:"arbitrators"` Compat uint64 `json:"compat"` FrozenAt time.Time `json:"frozen_at"` Gen map[string]uint64 `json:"gen"` MinAvailMemPct uint64 `json:"min_avail_mem"` MinAvailSwapPct uint64 `json:"min_avail_swap"` IsLeader bool `json:"is_leader"` Labels Labels `json:"labels"` }