targets

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCheckInterval = errors.New("invalid check interval")

ErrInvalidCheckInterval is returned when the check interval is invalid

View Source
var ErrInvalidRegistrationInterval = errors.New("invalid registration interval")

ErrInvalidRegistrationInterval is returned when the registration interval is invalid

View Source
var ErrInvalidUnhealthyThreshold = errors.New("invalid unhealthy threshold")

ErrInvalidUnhealthyThreshold is returned when the unhealthy threshold is invalid

View Source
var ErrInvalidUpdateInterval = errors.New("invalid update interval")

ErrInvalidUpdateInterval is returned when the update interval is invalid

Functions

func NewGitlabManager

func NewGitlabManager(name string, gtmConfig TargetManagerConfig) *gitlabTargetManager

NewGitlabManager creates a new gitlabTargetManager

Types

type Config added in v0.3.1

type Config 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"`
}

Config is the general configuration of the target manager

func (*Config) Validate added in v0.3.1

func (tmc *Config) Validate() error

type GitlabTargetManagerConfig added in v0.3.1

type GitlabTargetManagerConfig struct {
	BaseURL   string `yaml:"baseUrl" mapstructure:"baseUrl"`
	Token     string `yaml:"token" mapstructure:"token"`
	ProjectID int    `yaml:"projectId" mapstructure:"projectId"`
}

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

type TargetManagerConfig added in v0.3.1

type TargetManagerConfig struct {
	Config `yaml:",inline" mapstructure:",squash"`
	Gitlab GitlabTargetManagerConfig `yaml:"gitlab" mapstructure:"gitlab"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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