hcp

package
v1.16.0-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Client   hcpclient.Client
	Provider scada.Provider
	Sink     metrics.MetricSink
}

Deps contains the interfaces that the rest of Consul core depends on for HCP integration.

func NewDeps

func NewDeps(cfg config.CloudConfig, logger hclog.Logger, nodeID types.NodeID) (Deps, error)

type Manager

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

func NewManager

func NewManager(cfg ManagerConfig) *Manager

NewManager returns an initialized Manager with a zero configuration. It won't do anything until UpdateConfig is called with a config that provides credentials to contact HCP.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run executes the Manager it's designed to be run in its own goroutine for the life of a server agent. It should be run even if HCP is not configured yet for servers since a config update might configure it later and UpdateConfig called. It will effectively do nothing if there are no HCP credentials set other than wait for some to be added.

func (*Manager) SendUpdate

func (m *Manager) SendUpdate()

func (*Manager) UpdateConfig

func (m *Manager) UpdateConfig(cfg ManagerConfig)

type ManagerConfig

type ManagerConfig struct {
	Client hcpclient.Client

	StatusFn    StatusCallback
	MinInterval time.Duration
	MaxInterval time.Duration

	Logger hclog.Logger
}

type MockHCPServer

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

func NewMockHCPServer

func NewMockHCPServer() *MockHCPServer

func (*MockHCPServer) AddEndpoint

func (s *MockHCPServer) AddEndpoint(e TestEndpoint)

AddEndpoint allows adding additional endpoints from other packages e.g. bootstrap (which can't be merged into one package due to dependency cycles). It's not safe to call this concurrently with any other call to AddEndpoint or ServeHTTP.

func (*MockHCPServer) ServeHTTP

func (s *MockHCPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StatusCallback

type StatusCallback func(context.Context) (hcpclient.ServerStatus, error)

type TestEndpoint

type TestEndpoint struct {
	Methods    []string
	PathSuffix string
	Handler    func(r *http.Request, cluster resource.Resource) (interface{}, error)
}

Directories

Path Synopsis
Package bootstrap handles bootstrapping an agent's config from HCP.
Package bootstrap handles bootstrapping an agent's config from HCP.
Package telemetry implements functionality to collect, aggregate, convert and export telemetry data in OpenTelemetry Protocol (OTLP) format.
Package telemetry implements functionality to collect, aggregate, convert and export telemetry data in OpenTelemetry Protocol (OTLP) format.

Jump to

Keyboard shortcuts

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