atc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Forwarder  string = "forwarder"
	Redirector string = "redirector"
	Server     string = "server"
	Consul     string = "consul"
	All        string = "all"
)

Variables

View Source
var UserVisibleModules = []string{
	Consul,
	Forwarder,
	Redirector,
	All,
}
View Source
var ValidTargets = []string{"all", "consul", "forwarder", "redirector", "server"}

ValidTargets holds the list of acceptable target modules.

Functions

func NewMultiHandler

func NewMultiHandler(handlers ...slog.Handler) slog.Handler

func OkHandler

func OkHandler() http.HandlerFunc

func RenderServicesTable

func RenderServicesTable(enabledModules map[string]bool) string

func ValidateConfig added in v0.2.0

func ValidateConfig(cfg Config) []error

ValidateConfig performs semantic and syntactical validation on the ATC config.

Types

type Atc

type Atc struct {
	Cfg Config

	Server *atc_server.Server

	Forwarder  *forwarder.Forwarder
	Redirector *redirector.Redirector
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Atc, error)

func (*Atc) ApplyFailoverOverride

func (t *Atc) ApplyFailoverOverride(ctx context.Context, service string, targetDc string, targetNs string, duration string) error

func (*Atc) DependenciesForModule

func (t *Atc) DependenciesForModule(mod string) []string

func (*Atc) ForceUnlock added in v0.4.0

func (t *Atc) ForceUnlock(ctx context.Context, moduleName string) error

func (*Atc) GetAtcEnabledServices

func (t *Atc) GetAtcEnabledServices(ctx context.Context) ([]string, error)

func (*Atc) GetEnabledModulesTable

func (t *Atc) GetEnabledModulesTable() string

func (*Atc) GetFederationStatus

func (t *Atc) GetFederationStatus(ctx context.Context) (map[string]string, error)

func (*Atc) GetLeaderDetails added in v0.4.0

func (t *Atc) GetLeaderDetails(ctx context.Context, moduleName string) (LeaderDetails, error)

func (*Atc) GetPredefinedStrategies added in v0.3.0

func (t *Atc) GetPredefinedStrategies(ctx context.Context) (string, error)

func (*Atc) IsLeader

func (t *Atc) IsLeader() bool

func (*Atc) ListActiveOverrides added in v0.3.0

func (t *Atc) ListActiveOverrides(ctx context.Context) ([]map[string]any, error)

func (*Atc) PurgeServiceResolver

func (t *Atc) PurgeServiceResolver(ctx context.Context, name string) error

func (*Atc) ReloadConfig

func (t *Atc) ReloadConfig(cfg Config)

func (*Atc) Run

func (t *Atc) Run(ctx context.Context) error

func (*Atc) TriggerConfigReload added in v0.3.0

func (t *Atc) TriggerConfigReload() error

func (*Atc) TriggerManualRedirect

func (t *Atc) TriggerManualRedirect(ctx context.Context, service string, redirectDc string, redirectNs string, duration string) error

func (*Atc) UserVisibleModuleNames

func (t *Atc) UserVisibleModuleNames() []string

type AuthConfig added in v0.3.0

type AuthConfig struct {
	Enabled               bool     `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	StaticKeys            []string `yaml:"static_keys" json:"static_keys" mapstructure:"static_keys"`
	ConsulTokenDelegation bool     `yaml:"consul_token_delegation" json:"consul_token_delegation" mapstructure:"consul_token_delegation"`
}

type Config

type Config struct {
	Name               string            `yaml:"service" mapstructure:"service"`
	Server             atc_server.Config `yaml:"server" mapstructure:"server"`
	Target             []string          `yaml:"target" mapstructure:"target"`
	ConsulAddr         string            `yaml:"consul_addr" mapstructure:"consul_addr"`
	ConsulToken        string            `yaml:"consul_token" mapstructure:"consul_token"`
	ConsulDC           string            `yaml:"consul_dc" mapstructure:"consul_dc"`
	ConsulNamespace    string            `yaml:"consul_namespace" mapstructure:"consul_namespace"`
	WriteRateLimit     string            `yaml:"write_rate_limit" mapstructure:"write_rate_limit"`
	DampeningPeriod    string            `yaml:"dampening_period" mapstructure:"dampening_period"`
	MinDampeningPeriod string            `yaml:"min_dampening_period" mapstructure:"min_dampening_period"`
	Strategies         StrategiesConfig  `yaml:"strategies" json:"strategies" mapstructure:"strategies"`
	HA                 HaConfig          `yaml:"ha" json:"ha" mapstructure:"ha"`
	Auth               AuthConfig        `yaml:"auth" json:"auth" mapstructure:"auth"`
	DryRun             bool              `yaml:"dry_run" json:"dry_run" mapstructure:"dry_run"`
}

type HaConfig

type HaConfig struct {
	Enabled    bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	LockKey    string `yaml:"lock_key" json:"lock_key" mapstructure:"lock_key"`
	SessionTTL string `yaml:"session_ttl" json:"session_ttl" mapstructure:"session_ttl"`
}

type LeaderDetails added in v0.4.0

type LeaderDetails struct {
	IsLeader   bool   `json:"is_leader"`
	LeaderNode string `json:"leader_node,omitempty"`
	LockKey    string `json:"lock_key"`
	SessionID  string `json:"session_id,omitempty"`
}

type LeaderStatusResponse added in v0.4.0

type LeaderStatusResponse struct {
	Leader      bool                     `json:"leader"`
	AuthEnabled bool                     `json:"auth_enabled"`
	Components  map[string]bool          `json:"components"`
	LocalNode   string                   `json:"local_node"`
	Modules     map[string]LeaderDetails `json:"modules"`
}

type MultiHandler

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

MultiHandler multiplexes slog records to multiple slog Handlers.

func (*MultiHandler) Enabled

func (m *MultiHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*MultiHandler) Handle

func (m *MultiHandler) Handle(ctx context.Context, r slog.Record) error

func (*MultiHandler) WithAttrs

func (m *MultiHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*MultiHandler) WithGroup

func (m *MultiHandler) WithGroup(name string) slog.Handler

type StrategiesConfig

type StrategiesConfig struct {
	Failover map[string]forwarder.FailoverStrategy  `yaml:"failover" json:"failover" mapstructure:"failover"`
	Redirect map[string]redirector.RedirectStrategy `yaml:"redirect" json:"redirect" mapstructure:"redirect"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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