Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( 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") )
View Source
var ( MonitorGlobalExpectStrings map[MonitorGlobalExpect]string MonitorGlobalExpectValues map[string]MonitorGlobalExpect )
View Source
var ( MonitorLocalExpectStrings map[MonitorLocalExpect]string MonitorLocalExpectValues map[string]MonitorLocalExpect )
View Source
var ( // MonitorStateStrings is a map that associates MonitorState enums with // their corresponding string representations. MonitorStateStrings map[MonitorState]string // MonitorStateValues maps string representations of various states to their // corresponding MonitorState constants. MonitorStateValues map[string]MonitorState // MonitorStateUnrankable is the node monitor states evicting a node from ranking algorithms MonitorStateUnrankable = map[MonitorState]any{ MonitorStateInit: nil, MonitorStateRejoin: nil, MonitorStateMaintenance: nil, MonitorStateUpgrade: nil, MonitorStateShutdownSuccess: nil, MonitorStateShutdownFailure: nil, MonitorStateShutdownProgress: nil, } )
Functions ¶
Types ¶
type ArbitratorStatus ¶
type ArbitratorStatus struct {
URL string `json:"url"`
Status status.T `json:"status"`
Weight int `json:"weight"`
}
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"`
MaxKeySize int64 `json:"max_key_size"`
MinAvailMemPct int `json:"min_avail_mem_pct"`
MinAvailSwapPct int `json:"min_avail_swap_pct"`
ReadyPeriod time.Duration `json:"ready_period"`
RejoinGracePeriod time.Duration `json:"rejoin_grace_period"`
SplitAction string `json:"split_action"`
SSHKey string `json:"sshkey"`
PRKey string `json:"prkey"`
}
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]) 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
type MonitorGlobalExpect ¶
type MonitorGlobalExpect int
const ( MonitorGlobalExpectInit MonitorGlobalExpect = iota MonitorGlobalExpectAborted MonitorGlobalExpectFrozen MonitorGlobalExpectNone MonitorGlobalExpectUnfrozen )
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 ( // Initialization and Miscellaneous states MonitorStateInit MonitorState = iota MonitorStateIdle MonitorStateRejoin MonitorStateMaintenance MonitorStateUpgrade // Freezing process states MonitorStateFreezeProgress MonitorStateFreezeFailure MonitorStateFreezeSuccess // Unfreezing process states MonitorStateUnfreezeProgress MonitorStateUnfreezeFailure MonitorStateUnfreezeSuccess // Draining process states MonitorStateDrainProgress MonitorStateDrainFailure MonitorStateDrainSuccess // Shutdown process states MonitorStateShutdownProgress MonitorStateShutdownFailure MonitorStateShutdownSuccess )
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"`
Pool map[string]pool.Status `json:"pool"`
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 Stats ¶
type Stats struct {
Load15M float64 `json:"load_15m"`
MemAvailPct int `json:"mem_avail"`
MemTotalMB uint64 `json:"mem_total"`
Score int `json:"score"`
SwapAvailPct int `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 Gen `json:"gen"`
IsLeader bool `json:"is_leader"`
IsOverloaded bool `json:"is_overloaded"`
Labels label.M `json:"labels"`
BootedAt time.Time `json:"booted_at"`
}
func (Status) IsUnfrozen ¶
Click to show internal directories.
Click to hide internal directories.