Documentation
¶
Index ¶
- func BaseRouteAttrs(p *config.PolicyConfig) model.RouteAttrs
- func Evaluate(healthy bool, lowerPriorityFilePresent bool, p *config.PolicyConfig) model.VIPState
- func RouteAttrsFor(p *config.PolicyConfig, state model.VIPState) model.RouteAttrs
- type BGPNotifier
- type CheckSeed
- type Manager
- func (m *Manager) AddVIP(cfg *config.VIPConfig)
- func (m *Manager) CombineChecks(vipName string, healthy map[string]bool) (result, ok bool)
- func (m *Manager) CommitVIP(ctx context.Context, cfg *config.VIPConfig, seeds map[string]CheckSeed) error
- func (m *Manager) GetVIPStatuses() []model.VIPStatus
- func (m *Manager) OnCheckResult(vipName, checkName string, result checks.Result)
- func (m *Manager) OnHealthTransition(t checks.HealthTransition)
- func (m *Manager) RemoveVIP(ctx context.Context, name string) error
- func (m *Manager) SetTransitionListener(fn func())
- func (m *Manager) VIPNames() []string
- type StateChange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseRouteAttrs ¶ added in v0.11.0
func BaseRouteAttrs(p *config.PolicyConfig) model.RouteAttrs
BaseRouteAttrs returns the attributes from the announce block: the base prepend and communities carried by every announcement of the VIP.
func RouteAttrsFor ¶ added in v0.11.0
func RouteAttrsFor(p *config.PolicyConfig, state model.VIPState) model.RouteAttrs
RouteAttrsFor returns the BGP attributes to originate the VIP with in the given state:
- announced: the announce block (base prepend + communities)
- pessimized: base prepend + lower_priority prepend, and the union of both community lists, so a degraded node never outranks a healthy node with a larger base prepend
- withdrawn: zero value (no route)
Types ¶
type BGPNotifier ¶
type CheckSeed ¶ added in v0.14.0
CheckSeed is the state a check starts from when a reload commits it: the verdict its shadow scheduler reached and the result that produced it.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) AddVIP ¶ added in v0.14.0
AddVIP registers a VIP added by a config reload. It starts withdrawn with unknown health, exactly like a VIP at startup.
func (*Manager) CombineChecks ¶ added in v0.12.0
CombineChecks applies the VIP's checks_policy to an ad-hoc per-check outcome (e.g. a triggered run). ok is false for an unknown VIP.
func (*Manager) CommitVIP ¶ added in v0.14.0
func (m *Manager) CommitVIP(ctx context.Context, cfg *config.VIPConfig, seeds map[string]CheckSeed) error
CommitVIP switches a VIP to a new definition with the same name and prefix. seeds carries the state of every check whose definition changed (its shadow verdict); checks absent from seeds keep their running state, checks absent from the new config are dropped. The VIP health and state are re-evaluated once, and the route is re-originated when the announce attributes changed.
func (*Manager) GetVIPStatuses ¶
func (*Manager) OnCheckResult ¶
func (*Manager) OnHealthTransition ¶
func (m *Manager) OnHealthTransition(t checks.HealthTransition)
func (*Manager) RemoveVIP ¶ added in v0.14.0
RemoveVIP withdraws a VIP's route if it is installed and forgets the VIP, including its metric series. The schedulers must already be stopped. A withdraw error is returned and the VIP is kept so a later reload (or restart) can retry; nothing else is left half done.
func (*Manager) SetTransitionListener ¶ added in v0.12.0
func (m *Manager) SetTransitionListener(fn func())
SetTransitionListener registers fn to be called after each VIP state transition. It must be set before the schedulers start.