agents

package
v0.0.0-...-b1a821f Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigAgent

type ConfigAgent interface {
	// GetMatchingConfig loads a configuration that matches the metadata,
	// allowing for regex matching on branch names.
	GetMatchingConfig(metadata api.Metadata) (api.ReleaseBuildConfiguration, error)
	GetAll() config.ByOrgRepo
	GetGeneration() int
	AddIndex(indexName string, indexFunc IndexFn) error
	GetFromIndex(indexName string, indexKey string) ([]*api.ReleaseBuildConfiguration, error)
	SubscribeToIndexChanges(indexName string) (<-chan IndexDelta, error)
}

ConfigAgent is an interface that can load configs from disk into memory and retrieve them when provided with a config.Info.

func NewConfigAgent

func NewConfigAgent(configPath string, errCh chan error, opts ...ConfigAgentOption) (ConfigAgent, error)

NewConfigAgent returns a ConfigAgent interface that automatically reloads when configs are changed on disk.

func NewFakeConfigAgent

func NewFakeConfigAgent(configs config.ByOrgRepo) ConfigAgent

NewFakeConfigAgent returns a new static config agent that can be used for tests

type ConfigAgentOption

type ConfigAgentOption func(*ConfigAgentOptions)

func WithConfigMetrics

func WithConfigMetrics(m *prometheus.CounterVec) ConfigAgentOption

func WithOrg

func WithOrg(org string) ConfigAgentOption

func WithRepo

func WithRepo(repo string) ConfigAgentOption

type ConfigAgentOptions

type ConfigAgentOptions struct {
	// ErrorMetric holds the CounterVec to count errors on. It must include a `error` label
	// or the agent panics on the first error.
	ErrorMetric *prometheus.CounterVec

	UniversalSymlinkWatcher *UniversalSymlinkWatcher

	Org  string
	Repo string
}

type IndexDelta

type IndexDelta struct {
	IndexKey string
	Added    []*api.ReleaseBuildConfiguration
	Removed  []*api.ReleaseBuildConfiguration
}

type IndexFn

type IndexFn func(api.ReleaseBuildConfiguration) []string

IndexFn can be used to add indexes to the ConfigAgent

type RegistryAgent

type RegistryAgent interface {
	ResolveConfig(config api.ReleaseBuildConfiguration) (api.ReleaseBuildConfiguration, error)
	GetRegistryComponents() (registry.ReferenceByName, registry.ChainByName, registry.WorkflowByName, map[string]string, api.RegistryMetadata)
	GetGeneration() int
	GetClusterProfiles() api.ClusterProfilesMap
	GetClusterProfileDetails(profileName string) (*api.ClusterProfileDetails, error)
	registry.Resolver
}

RegistryAgent is an interface that can load a registry from disk into memory and resolve ReleaseBuildConfigurations using the registry

func NewRegistryAgent

func NewRegistryAgent(registryPath string, errCh chan error, opts ...RegistryAgentOption) (RegistryAgent, error)

NewRegistryAgent returns a RegistryAgent interface that automatically reloads when the registry is changed on disk.

type RegistryAgentOption

type RegistryAgentOption func(*RegistryAgentOptions)

func WithRegistryFlat

func WithRegistryFlat(v bool) RegistryAgentOption

func WithRegistryMetrics

func WithRegistryMetrics(m *prometheus.CounterVec) RegistryAgentOption

type RegistryAgentOptions

type RegistryAgentOptions struct {
	// ErrorMetric holds the CounterVec to count errors on. It must include a `error` label
	// or the agent panics on the first error.
	ErrorMetric *prometheus.CounterVec
	// FlatRegistry describes if the registry is flat, which means org/repo/branch info can not be inferred
	// from the filepath. Defaults to true.
	FlatRegistry            *bool
	UniversalSymlinkWatcher *UniversalSymlinkWatcher
}

type UniversalSymlinkWatcher

type UniversalSymlinkWatcher struct {
	WatchPath       string
	EventCh         chan fsnotify.Event
	ErrCh           chan error
	ConfigEventFn   func() error
	RegistryEventFn func() error
}

func (*UniversalSymlinkWatcher) GetWatcher

func (u *UniversalSymlinkWatcher) GetWatcher() (func(ctx context.Context), error)

Jump to

Keyboard shortcuts

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