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 ¶
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 ¶
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 ¶
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 ¶
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.