targets

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidCheckInterval is returned when the check interval is invalid
	ErrInvalidCheckInterval = errors.New("invalid check interval")
	// ErrInvalidRegistrationInterval is returned when the registration interval is invalid
	ErrInvalidRegistrationInterval = errors.New("invalid registration interval")
	// ErrInvalidUnhealthyThreshold is returned when the unhealthy threshold is invalid
	ErrInvalidUnhealthyThreshold = errors.New("invalid unhealthy threshold")
	// ErrInvalidUpdateInterval is returned when the update interval is invalid
	ErrInvalidUpdateInterval = errors.New("invalid update interval")
	// ErrInvalidInteractorType is returned when the interactor type isn't recognized
	ErrInvalidInteractorType = errors.New("invalid interactor type")
	// ErrInvalidScheme is returned when the scheme is not http or https
	ErrInvalidScheme = errors.New("scheme must be 'http' of 'https'")
)

Functions

This section is empty.

Types

type General added in v0.3.2

type General struct {
	// The interval for the target reconciliation process
	CheckInterval time.Duration `yaml:"checkInterval" mapstructure:"checkInterval"`
	// How often the instance should register itself as a global target.
	// A duration of 0 means no registration.
	RegistrationInterval time.Duration `yaml:"registrationInterval" mapstructure:"registrationInterval"`
	// How often the instance should update its registration as a global target.
	// A duration of 0 means no update.
	UpdateInterval time.Duration `yaml:"updateInterval" mapstructure:"updateInterval"`
	// The amount of time a target can be unhealthy
	// before it is removed from the global target list.
	// A duration of 0 means no removal.
	UnhealthyThreshold time.Duration `yaml:"unhealthyThreshold" mapstructure:"unhealthyThreshold"`
	// Scheme is the scheme used for the remote target manager
	// Can either be http or https
	Scheme string `yaml:"scheme" mapstructure:"scheme"`
}

General is the general configuration of the target manager

type TargetManager

type TargetManager interface {
	// Reconcile fetches the global targets from the configured
	// endpoint and updates the local state
	Reconcile(ctx context.Context) error
	// GetTargets returns the current global targets
	GetTargets() []checks.GlobalTarget
	// Shutdown shuts down the target manager
	// and unregisters the instance as a global target
	Shutdown(ctx context.Context) error
}

TargetManager handles the management of globalTargets for a Sparrow instance

func NewManager added in v0.3.2

func NewManager(name string, cfg TargetManagerConfig) TargetManager

NewManager creates a new target manager

type TargetManagerConfig added in v0.3.1

type TargetManagerConfig struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
	// Type defines which target manager to use
	Type interactor.Type `yaml:"type" mapstructure:"type"`
	// General is the general configuration of the target manager
	General `yaml:",inline" mapstructure:",squash"`
	// Config is the configuration for the Config target manager
	interactor.Config `yaml:",inline" mapstructure:",squash"`
}

TargetManagerConfig is the configuration for the target manager

func (*TargetManagerConfig) Validate added in v0.3.2

func (c *TargetManagerConfig) Validate(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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