reload

package
v0.14.1 Latest Latest
Warning

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

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

Documentation

Overview

Package reload applies a changed config file to a running daemon.

Only the vips list and logging.level reload live; a change to any other section rejects the whole reload, so the daemon either runs exactly what the file says or reports why not. Removed VIPs are withdrawn, added VIPs start withdrawn and prove health through rise, and a VIP whose checks changed keeps running its old checks until every new one has reached a verdict in shadow (make-before-break): a healthy target never withdraws for a check tweak, an unhealthy one withdraws as soon as the new check says so.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSchedulers

func NewSchedulers(v *config.VIPConfig, list []*config.CheckConfig, m *metrics.Metrics, newChecker func(*config.CheckConfig) (checks.Checker, error)) ([]*checks.Scheduler, error)

NewSchedulers constructs the schedulers for the given checks of a VIP, wrapped in the local address guard when the VIP asks for it. Nothing runs yet. The daemon builds its startup schedulers with it too, so a reloaded check behaves exactly like one configured at start.

Types

type Policy

type Policy interface {
	AddVIP(cfg *config.VIPConfig)
	RemoveVIP(ctx context.Context, name string) error
	CommitVIP(ctx context.Context, cfg *config.VIPConfig, seeds map[string]policy.CheckSeed) error
	OnHealthTransition(t checks.HealthTransition)
	OnCheckResult(vipName, checkName string, result checks.Result)
}

Policy is the part of policy.Manager a reload drives.

type Reloader

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

Reloader holds the running config and applies new versions of the file.

func New

func New(path string, cfg *config.Config, raw []byte, pol Policy, reg *checks.Registry, m *metrics.Metrics, bgpMgr *bgp.Manager, onChange func()) *Reloader

New returns a reloader for the config loaded from path. raw is the file as read at startup.

func (*Reloader) Config

func (r *Reloader) Config() *config.Config

Config returns the running config.

func (*Reloader) LockLogLevel

func (r *Reloader) LockLogLevel()

LockLogLevel makes reloads ignore logging.level, for `run --debug`.

func (*Reloader) Reload

func (r *Reloader) Reload(ctx context.Context) model.ReloadStatus

Reload reads the file and applies the difference to the running daemon. It is safe to call concurrently; attempts are serialized.

func (*Reloader) Run

func (r *Reloader) Run(ctx context.Context, pollInterval time.Duration)

Run drives shadow promotions and polls the file for edits until ctx ends.

func (*Reloader) Status

func (r *Reloader) Status() model.ConfigStatus

Status describes the running config and the last reload.

Jump to

Keyboard shortcuts

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