policy

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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 Evaluate

func Evaluate(healthy bool, lowerPriorityFilePresent bool, p *config.PolicyConfig) model.VIPState

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 BGPNotifier interface {
	AnnounceVIP(ctx context.Context, prefix string, attrs model.RouteAttrs) error
	WithdrawVIP(ctx context.Context, prefix string) error
	PessimizeVIP(ctx context.Context, prefix string, attrs model.RouteAttrs) error
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(vipConfigs []config.VIPConfig, m *metrics.Metrics, notifier BGPNotifier) *Manager

func (*Manager) CombineChecks added in v0.12.0

func (m *Manager) CombineChecks(vipName string, healthy map[string]bool) (result, ok bool)

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) GetVIPStatuses

func (m *Manager) GetVIPStatuses() []model.VIPStatus

func (*Manager) OnCheckResult

func (m *Manager) OnCheckResult(vipName, checkName string, result checks.Result)

func (*Manager) OnHealthTransition

func (m *Manager) OnHealthTransition(t checks.HealthTransition)

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.

type StateChange

type StateChange struct {
	VIPName  string
	Prefix   string
	OldState model.VIPState
	NewState model.VIPState
	Reason   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL