agentkapp

package
v17.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 87 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

Types

type App

type App struct {
	Log                *slog.Logger
	LogLevel           *slog.LevelVar
	GRPCLogLevel       *slog.LevelVar
	Validator          prototool.Validator
	AgentMeta          *entity.AgentMeta
	AgentID            *syncz.ValueHolder[int64]
	GitLabExternalURL  *syncz.ValueHolder[url.URL]
	ServiceAccountName string

	// KASAddress specifies the address of kas.
	// This field is used as a flag. If set, agentk is in the agentk->kas communication mode.
	// If not set, kas->agentk mode is activated.
	KASAddress       string
	KASCACertFile    string
	KASHeaders       []string
	KASSkipTLSVerify bool
	KASTLSServerName string

	APIListenNetwork string
	APIListenAddress string
	APICertFile      string
	APIKeyFile       string
	APIJWTFile       string
	APICACertFile    string
	APIMTLS          bool

	PrivateAPIListenNetwork string
	PrivateAPIListenAddress string
	PrivateAPICertFile      string
	PrivateAPIKeyFile       string
	PrivateAPICACertFile    string
	PrivateAPIJWTFile       string

	ObservabilityListenNetwork string
	ObservabilityListenAddress string
	ObservabilityCertFile      string
	ObservabilityKeyFile       string

	TokenFile       string
	AgentToken      api.AgentToken
	K8sClientGetter genericclioptions.RESTClientGetter
}

func (*App) Run

func (a *App) Run(ctx context.Context) error

type CancelRunWhenLeaderFunc

type CancelRunWhenLeaderFunc func()

type LeaderElector

type LeaderElector interface {
	Run(ctx context.Context, onStartedLeading, onStoppedLeading func())
}

type ModuleStartFunc

type ModuleStartFunc func()

type ModuleStopFunc

type ModuleStopFunc func() ModuleStopWaitFunc

type ModuleStopWaitFunc

type ModuleStopWaitFunc func(context.Context) error

type Runner

type Runner interface {
	// RunWhenLeader registers the given start and stop functions for this module with the leader runner.
	// When the leader runner is elected as the leader it will execute the start function and
	// when the leader runner lost the leadership it will execute the stop function.
	// The start function must be able to be triggered multiple times (with intermediate stop executions)
	// without having to rely on a new agent configuration.
	// The function that is returned must be used to unregister the module
	// from the leader runner in case a shutdown is initiated or a previously registered start function
	// became invalid, for example because a new agent configuration turned out to be invalid.
	RunWhenLeader(ctx context.Context, startFn ModuleStartFunc, stopFunc ModuleStopFunc) (CancelRunWhenLeaderFunc, error)
}

Jump to

Keyboard shortcuts

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