agent

package
v1.1.115 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotYetSynced is returned when the config hasn't been synced yet.
	ErrNotYetSynced = erx.New("Heist Agent", "Config is not synced yet").
					WithDetails("config has not been synced to the agent yet, this may take up to a couple of seconds")
	// ErrAPIRequestFailed is returned when vault returned an unexpected response.
	ErrAPIRequestFailed = erx.New("Heist Agent", "REST requests to Vault could not be completed")
	// ErrNotFound is returned when a secret doesn't exist.
	ErrNotFound = erx.New("Heist Agent", "not found")
)
View Source
var ErrInitAgentFailed = erx.New("Heist Agent", "failed to initialize new agent")

ErrInitAgentFailed is returned when the agent can't be initialized.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	ListSecrets() (names []string, err error)
	FetchSecret(name string) (secret *Secret, err error)
	GetClientSecret() *Secret
	GetStatus() *SyncStatus
	Stop()
	CreateUpdateChannel(chan bool)
}

func New

func New(opts ...Option) (Agent, error)

type Option

type Option func(a *agent) error

func WithBasePath

func WithBasePath(path string) Option

func WithClientConfig

func WithClientConfig(namespace string, name string) Option

func WithKubeConfig

func WithKubeConfig(masterURL string, kubeConfigPath string) Option

func WithLogger

func WithLogger(logger logr.Logger) Option

func WithRestConfig

func WithRestConfig(config *rest.Config) Option

func WithTokenPath

func WithTokenPath(path string) Option

func WithVaultToken

func WithVaultToken(token string) Option

type Secret

type Secret struct {
	Value      string
	Name       string
	OutputPath string
	Mode       os.FileMode
}

type StatusType

type StatusType string
const (
	// StatusNotYetSynced indicates that the agent hasn't yet fetched it's config.
	StatusNotYetSynced StatusType = "not_yet_synced"
	// StatusSynced indicates that the agent has successfully fetched the config
	// and all configured secrets.
	StatusSynced StatusType = "synced"
	// StatusStopped indicates that the agent has been stopped and will no longer sync secrets.
	StatusStopped StatusType = "stopped"
	// StatusError indicates that an error has occurred.
	StatusError StatusType = "error"
)

type SyncStatus

type SyncStatus struct {
	Status StatusType
	Reason string
}

Jump to

Keyboard shortcuts

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