Documentation
¶
Overview ¶
Package state holds the desired admin state for haproxy servers and keeps it in sync with consul KV. Keys below the prefix are agent-send identities ("backend/server"), values are agent-check replies. An absent key means ready.
Index ¶
Constants ¶
View Source
const ( StateReady = "ready" StateDrain = "drain" StateMaint = "maint" )
Health states (up, down, stopped, fail) are not accepted: server health belongs to haproxy's own checks, the control plane only sets admin state.
Variables ¶
This section is empty.
Functions ¶
func ValidValue ¶
ValidValue reports whether v is an agent-check reply this agent is willing to serve. haproxy caps weights at 256.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory copy of the desired state, so lookups never wait on consul.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher keeps a Store in sync with a consul KV prefix using blocking queries.
func NewWatcher ¶
func NewWatcher(cfg WatcherConfig) *Watcher
type WatcherConfig ¶
type WatcherConfig struct {
Consul *consulapi.Client
Prefix string
Store *Store
Logger *slog.Logger
Registerer prometheus.Registerer
WaitTime time.Duration
}
Click to show internal directories.
Click to hide internal directories.