Documentation
¶
Overview ¶
Package fleet is deploy's read-only view of Warden's cluster membership.
The package owns polling one Warden status endpoint, normalizing the reply into an immutable Snapshot, and projecting configured node labels onto that snapshot for placement and the operator UI. Callers may rely on Client being safe for concurrent use, on Snapshot returning a defensive copy rather than shared state, and on a failed refresh preserving the last observed membership while clearing authority and quorum and recording the error — never on it reporting an empty fleet.
Leadership, term, and quorum are Warden's observations and are never inferred here; node Role and Labels are fixed Core configuration. The package performs no writes and makes no placement decision.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client polls one Warden status endpoint and caches the latest observation. It is safe for concurrent use.
func NewWardenClient ¶
NewWardenClient constructs the fleet observer for one Warden endpoint.
func (*Client) Refresh ¶
Refresh polls Warden once and stores the result. On failure it returns both the recorded error snapshot and the error, so a caller that only wants display state can ignore the second value.
type ConfiguredNode ¶
type ConfiguredNode struct {
ID string `json:"id"`
Name string `json:"name"`
Role string `json:"role"`
Labels map[string]string `json:"labels"`
Status string `json:"status"`
Address string `json:"address"`
LastSeen time.Time `json:"last_seen"`
}
ConfiguredNode combines fixed deployment configuration with Warden's observed membership state. Leadership remains a property of the containing snapshot and is never inferred from Role.
type ConfiguredSnapshot ¶
type ConfiguredSnapshot struct {
Self string `json:"self"`
LeaderID string `json:"leader_id"`
Term uint64 `json:"term"`
Authoritative bool `json:"authoritative"`
HasQuorum bool `json:"has_quorum"`
Online int `json:"online"`
Required int `json:"required"`
Nodes []ConfiguredNode `json:"nodes"`
UpdatedAt time.Time `json:"updated_at"`
Error string `json:"error,omitempty"`
}
ConfiguredSnapshot is the operator-facing fleet status. LeaderID and Term are dynamic Warden observations; node Role and Labels are fixed Core configuration used by placement.
func WithConfiguration ¶
func WithConfiguration(snapshot Snapshot, configured map[string]map[string]string) ConfiguredSnapshot
WithConfiguration projects configured labels onto a Warden snapshot without mutating either input.
type Node ¶
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Role string `json:"role"`
Status string `json:"status"`
Address string `json:"address"`
LastSeen time.Time `json:"last_seen"`
}
Node is one member of the cluster as Warden currently observes it. Every field is an observation; none of it is Core configuration.
type Snapshot ¶
type Snapshot struct {
Self string `json:"self"`
LeaderID string `json:"leader_id"`
Term uint64 `json:"term"`
Authoritative bool `json:"authoritative"`
HasQuorum bool `json:"has_quorum"`
Online int `json:"online"`
Required int `json:"required"`
Nodes []Node `json:"nodes"`
UpdatedAt time.Time `json:"updated_at"`
Error string `json:"error,omitempty"`
}
Snapshot is one immutable observation of the cluster. Error is set when the most recent refresh failed, in which case the membership is the last good one and Authoritative and HasQuorum are cleared.