agent

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MPL-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package agent provides a daemon capable of running remote operations on behalf of a user.

Index

Constants

View Source
const (
	DefaultID          = "agent-001"
	DefaultConcurrency = 5
)
View Source
const HashicorpReleasesHost = "releases.hashicorp.com"

Variables

View Source
var (
	PluginCacheDir = filepath.Join(os.TempDir(), "plugin-cache")
	DefaultEnvs    = []string{
		"TF_IN_AUTOMATION=true",
		"CHECKPOINT_DISABLE=true",
	}
)

Functions

func NewAgent

func NewAgent(logger logr.Logger, app client.Client, cfg Config) (*agent, error)

NewAgent is the constructor for an agent

func NewDownloader added in v0.1.2

func NewDownloader(pathFinder *TerraformPathFinder) *terraformDownloader

NewDownloader constructs a terraform downloader. Pass a path finder to customise the location to which the bins are persisted, or pass nil to use the default.

func NewExternalAgent

func NewExternalAgent(ctx context.Context, logger logr.Logger, cfg ExternalConfig) (*agent, error)

NewExternalAgent constructs an external agent, which communicates with otfd via http

Types

type Config

type Config struct {
	Organization    *string // only process runs belonging to org
	External        bool    // dedicated agent (true) or integrated into otfd (false)
	Concurrency     int     // number of workers
	Sandbox         bool    // isolate privileged ops within sandbox
	Debug           bool    // toggle debug mode
	PluginCache     bool    // toggle use of terraform's shared plugin cache
	TerraformBinDir string  // destination directory for terraform binaries
}

Config is configuration for an agent.

func NewConfigFromFlags

func NewConfigFromFlags(flags *pflag.FlagSet) *Config

type Downloader

type Downloader interface {
	Download(ctx context.Context, version string, w io.Writer) (string, error)
}

Downloader downloads a specific version of a binary and returns its path

type ExternalConfig

type ExternalConfig struct {
	HTTPConfig http.Config

	Config
}

ExternalConfig is configuration for an external agent

func NewExternalConfigFromFlags

func NewExternalConfigFromFlags(flags *pflag.FlagSet) *ExternalConfig

type TerraformPathFinder added in v0.1.2

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

func (*TerraformPathFinder) TerraformPath added in v0.1.2

func (t *TerraformPathFinder) TerraformPath(version string) string

Jump to

Keyboard shortcuts

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