bootstrap

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package bootstrap handles bootstrapping an agent's config from HCP. It must be a separate package from other HCP components because it has a dependency on agent/config while other components need to be imported and run within the server process in agent/consul and that would create a dependency cycle.

Index

Constants

View Source
const TestExistingClusterID = "133114e7-9745-41ce-b1c9-9644a20d2952"

Variables

This section is empty.

Functions

func TestEndpoint

func TestEndpoint() hcp.TestEndpoint

TestEndpoint returns an hcp.TestEndpoint to be used in an hcp.MockHCPServer.

Types

type ConfigLoader

type ConfigLoader func(source config.Source) (config.LoadResult, error)

func LoadConfig added in v1.14.7

func LoadConfig(ctx context.Context, client hcpclient.Client, dataDir string, loader ConfigLoader, ui UI) (ConfigLoader, error)

LoadConfig will attempt to load previously-fetched config from disk and fall back to fetch from HCP servers if the local data is incomplete. It must be passed a (CLI) UI implementation so it can deliver progress updates to the user, for example if it is waiting to retry for a long period.

type RawBootstrapConfig added in v1.14.7

type RawBootstrapConfig struct {
	ConfigJSON      string
	ManagementToken string
}

RawBootstrapConfig contains the Consul config as a raw JSON string and the management token which either was retrieved from persisted files or from the bootstrap endpoint

type UI

type UI interface {
	Output(string)
	Warn(string)
	Info(string)
	Error(string)
}

UI is a shim to allow the agent command to pass in it's mitchelh/cli.UI so we can output useful messages to the user during bootstrapping. For example if we have to retry several times to bootstrap we don't want the agent to just stall with no output which is the case if we just returned all intermediate warnings or errors.

Jump to

Keyboard shortcuts

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