config

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DevKeyGeneration added in v0.1.8

func DevKeyGeneration() string

Types

type Config

type Config struct {
	*configutil.SharedConfig `hcl:"-"`

	Worker     *Worker     `hcl:"worker"`
	Controller *Controller `hcl:"controller"`

	// Dev-related options
	DevController           bool   `hcl:"-"`
	DevUiPassthroughDir     string `hcl:"-"`
	DevControllerKey        string `hcl:"-"`
	DevWorkerAuthKey        string `hcl:"-"`
	DevWorkerAuthStorageKey string `hcl:"-"`
	DevRecoveryKey          string `hcl:"-"`

	// Eventing configuration for the controller
	Eventing *event.EventerConfig `hcl:"events"`

	// Plugin-related options
	Plugins Plugins `hcl:"plugins"`

	// Internal field for use with HCP deployments. Used if controllers/ initial_upstreams is not set
	HcpbClusterId string `hcl:"hcp_boundary_cluster_id"`
}

Config is the configuration for the boundary controller

func DevCombined

func DevCombined() (*Config, error)

func DevController

func DevController() (*Config, error)

DevController is a Config that is used for dev mode of Boundary controllers

func DevWorker

func DevWorker() (*Config, error)

DevWorker is a Config that is used for dev mode of Boundary workers

func Load added in v0.11.1

func Load(ctx context.Context, paths []string, wrapperPath string) (*Config, error)

Load will create a Config from the given config files. It concatenates the contents of the files together. This allows for composing a config from separate files, but notably does not attempt any merging of configs. Thus it is possible that the concatenation results in an invalid config file. This also supports decrypting the config, either with a kms block in one of the given files, or as a separate file in wrapperPath.

Note that having multiple config files is only supported properly if they are all hcl files. If they are json files, only the first file is used. A mix of hcl and json will result in an error.

func New

func New() *Config

func Parse

func Parse(d string) (*Config, error)

func (*Config) Sanitized

func (c *Config) Sanitized() map[string]interface{}

Sanitized returns a copy of the config with all values that are considered sensitive stripped. It also strips all `*Raw` values that are mainly used for parsing.

Specifically, the fields that this method strips are: - KMS.Config - Telemetry.CirconusAPIToken

func (*Config) SetupControllerPublicClusterAddress added in v0.10.4

func (c *Config) SetupControllerPublicClusterAddress(flagValue string) error

SetupControllerPublicClusterAddress will set the controller public address. If the flagValue is provided it will be used. Otherwise this will use the address from cluster listener. In either case it will check to see if no port is included, and if not it will set the default port of 9201.

If there are any errors parsing the address from the flag or listener, and error is returned.

func (*Config) SetupWorkerInitialUpstreams added in v0.10.4

func (c *Config) SetupWorkerInitialUpstreams() error

SetupWorkerInitialUpstreams will set the worker initial upstreams in cases where both a worker and controller stanza are provided. The initial upstreams will be: - The initialily provided value, if it is the same as the controller's cluster address - The controller's public cluster address if it it was set - The controller's cluster listener's address

Any other value already set for iniital upstream will result in an error.

type Controller

type Controller struct {
	Name              string     `hcl:"name"`
	Description       string     `hcl:"description"`
	Database          *Database  `hcl:"database"`
	PublicClusterAddr string     `hcl:"public_cluster_addr"`
	Scheduler         *Scheduler `hcl:"scheduler"`

	// AuthTokenTimeToLive is the total valid lifetime of a token denoted by time.Duration
	AuthTokenTimeToLive         interface{}   `hcl:"auth_token_time_to_live"`
	AuthTokenTimeToLiveDuration time.Duration `hcl:"-"`

	// AuthTokenTimeToStale is the total time a token can go unused before becoming invalid
	// denoted by time.Duration
	AuthTokenTimeToStale         interface{}   `hcl:"auth_token_time_to_stale"`
	AuthTokenTimeToStaleDuration time.Duration `hcl:"-"`

	// GracefulShutdownWait is the amount of time that we'll wait before actually
	// starting the Controller shutdown. This allows the health endpoint to
	// return a status code to indicate that the instance is shutting down.
	GracefulShutdownWait         interface{}   `hcl:"graceful_shutdown_wait_duration"`
	GracefulShutdownWaitDuration time.Duration `hcl:"-"`

	// WorkerStatusGracePeriod represents the period of time (as a duration)
	// that the controller will wait before deciding a worker is disconnected
	// and marking connections from it as canceling
	//
	// TODO: This isn't documented (on purpose) because the right place for this
	// is central configuration so you can't drift across controllers, but we
	// don't have that yet.
	WorkerStatusGracePeriod         interface{}   `hcl:"worker_status_grace_period"`
	WorkerStatusGracePeriodDuration time.Duration `hcl:"-"`

	// LivenessTimeToStale represents the period of time (as a duration) after
	// which it will consider other controllers to be no longer accessible,
	// based on time since their last status update in the database
	//
	// TODO: This isn't documented (on purpose) because the right place for this
	// is central configuration so you can't drift across controllers, but we
	// don't have that yet.
	LivenessTimeToStale         interface{}   `hcl:"liveness_time_to_stale"`
	LivenessTimeToStaleDuration time.Duration `hcl:"-"`

	// SchedulerRunJobInterval is the time interval between waking up the
	// scheduler to run pending jobs.
	//
	// TODO: This field is currently internal.
	SchedulerRunJobInterval time.Duration `hcl:"-"`
}

func (*Controller) InitNameIfEmpty added in v0.5.0

func (c *Controller) InitNameIfEmpty() error

type Database

type Database struct {
	Url                     string         `hcl:"url"`
	MigrationUrl            string         `hcl:"migration_url"`
	MaxOpenConnections      int            `hcl:"-"`
	MaxOpenConnectionsRaw   interface{}    `hcl:"max_open_connections"`
	MaxIdleConnections      *int           `hcl:"-"`
	MaxIdleConnectionsRaw   interface{}    `hcl:"max_idle_connections"`
	ConnMaxIdleTime         interface{}    `hcl:"max_idle_time"`
	ConnMaxIdleTimeDuration *time.Duration `hcl:"-"`

	// SkipSharedLockAcquisition allows skipping grabbing the database shared
	// lock. This is dangerous unless you know what you're doing, and you should
	// not set it unless you are the reason it's here in the first place, as not
	// only it dangerous but it will be removed at some point in the future.
	SkipSharedLockAcquisition bool `hcl:"skip_shared_lock_acquisition"`
}

type Plugins added in v0.7.0

type Plugins struct {
	ExecutionDir string `hcl:"execution_dir"`
}

type Scheduler added in v0.11.0

type Scheduler struct {
	// JobRunInterval is the time interval between waking up the
	// scheduler to run pending jobs.
	//
	JobRunInterval         interface{} `hcl:"job_run_interval"`
	JobRunIntervalDuration time.Duration

	// MonitorInterval is the time interval between waking up the
	// scheduler to monitor for jobs that are defunct.
	//
	MonitorInterval         interface{} `hcl:"monitor_interval"`
	MonitorIntervalDuration time.Duration
}

Scheduler is the configuration block that specifies the job scheduler behavior on the controller

type Worker

type Worker struct {
	Name        string `hcl:"name"`
	Description string `hcl:"description"`
	PublicAddr  string `hcl:"public_addr"`

	// We use a raw interface here so that we can take in a string
	// value pointing to an env var or file. We then resolve that
	// and get the actual upstream controller or worker addresses.
	InitialUpstreams    []string `hcl:"-"`
	InitialUpstreamsRaw any      `hcl:"initial_upstreams"`

	// The ControllersRaw field is deprecated and users should use InitialUpstreamsRaw instead.
	// TODO: remove this field when support is discontinued.
	ControllersRaw interface{} `hcl:"controllers"`

	// We use a raw interface for parsing so that people can use JSON-like
	// syntax that maps directly to the filter input or possibly more familiar
	// key=value syntax, as well as accepting a string denoting an env or file
	// pointer. This is trued up in the Parse function below.
	Tags    map[string][]string `hcl:"-"`
	TagsRaw interface{}         `hcl:"tags"`

	// StatusCallTimeout represents the period of time (as a duration) that
	// the worker will allow a status RPC call to attempt to finish before
	// canceling it to try again.
	//
	// TODO: This is currently not documented and considered internal.
	StatusCallTimeout         interface{}   `hcl:"status_call_timeout"`
	StatusCallTimeoutDuration time.Duration `hcl:"-"`

	// SuccessfulStatusGracePeriod represents the period of time (as a duration)
	// that the worker will wait before disconnecting connections if it cannot
	// successfully complete a status report to a controller. This cannot be
	// less than StatusCallTimeout.
	//
	// TODO: This is currently not documented and considered internal.
	SuccessfulStatusGracePeriod         interface{}   `hcl:"successful_status_grace_period"`
	SuccessfulStatusGracePeriodDuration time.Duration `hcl:"-"`

	// AuthStoragePath represents the location a worker stores its node credentials, if set
	AuthStoragePath string `hcl:"auth_storage_path"`

	// ControllerGeneratedActivationToken is a controller-generated activation
	// token used to register this worker to the cluster. It can be a path, env
	// var, or direct value.
	ControllerGeneratedActivationToken string `hcl:"controller_generated_activation_token"`
}

Jump to

Keyboard shortcuts

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