preset

package
v0.0.0-...-19ab7e0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PresetSecure     = "secure"
	PresetQuickstart = "quickstart"
	PresetCloud      = "cloud"

	EnvHCPClientID     = "HCP_CLIENT_ID"
	EnvHCPClientSecret = "HCP_CLIENT_SECRET"
	EnvHCPAuthURL      = "HCP_AUTH_URL"
	EnvHCPAPIHost      = "HCP_API_HOST"
	EnvHCPScadaAddress = "HCP_SCADA_ADDRESS"
)

Variables

Presets is a list of all the available presets for use with CLI's install and uninstall commands.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Tokens Tokens `json:"tokens"`
}

ACL represents 'cluster.consul_config.acl' in the response fetched from the agent bootstrap config endpoint in HCP.

type CloudBootstrapConfig

type CloudBootstrapConfig struct {
	BootstrapResponse *models.HashicorpCloudGlobalNetworkManager20220215AgentBootstrapResponse
	ConsulConfig      ConsulConfig
	HCPConfig         HCPConfig
}

CloudBootstrapConfig represents the response fetched from the agent bootstrap config endpoint in HCP.

type CloudPreset

type CloudPreset struct {
	HCPConfig           *HCPConfig
	KubernetesClient    kubernetes.Interface
	KubernetesNamespace string
	UI                  terminal.UI
	SkipSavingSecrets   bool
	Context             context.Context
	HTTPClient          *http.Client
}

CloudPreset struct is an implementation of the Preset interface that is used to fetch agent bootrap config from HCP, save it to secrets, and provide a Helm values map that is used during installation.

func (*CloudPreset) GetValueMap

func (c *CloudPreset) GetValueMap() (map[string]interface{}, error)

GetValueMap must fetch configuration from HCP, save various secrets from the response, and map the secret names into the returned value map.

type ConsulConfig

type ConsulConfig struct {
	ACL ACL `json:"acl"`
}

ConsulConfig represents 'cluster.consul_config' in the response fetched from the agent bootstrap config endpoint in HCP.

type DemoPreset

type DemoPreset struct{}

DemoPreset struct is an implementation of the Preset interface that provides a Helm values map that is used during installation and represents the the quickstart configuration for Consul on Kubernetes.

func (*DemoPreset) GetValueMap

func (i *DemoPreset) GetValueMap() (map[string]interface{}, error)

GetValueMap returns the Helm value map representing the quickstart configuration for Consul on Kubernetes. It does the following: - server replicas equal to 1. - enables the service mesh. - enables the ui. - enables metrics. - enables Prometheus.

type GetPresetConfig

type GetPresetConfig struct {
	Name        string
	CloudPreset *CloudPreset
}

type HCPConfig

type HCPConfig struct {
	ResourceID                string
	ClientID                  string
	ClientSecret              string
	ObservabilityClientID     string
	ObservabilityClientSecret string
	AuthURL                   string
	APIHostname               string
	ScadaAddress              string
}

HCPConfig represents the resource-id, client-id, and client-secret provided by the user in order to make a call to fetch the agent bootstrap config data from the endpoint in HCP.

func GetHCPPresetFromEnv

func GetHCPPresetFromEnv(resourceID string) *HCPConfig

type Preset

type Preset interface {
	GetValueMap() (map[string]interface{}, error)
}

Preset is the interface that each instance must implement. For demo and secure presets, they merely return a pre-configred value map. For cloud, it must fetch configuration from HCP, save various secrets from the response, and map the secret names into the value map.

func GetPreset

func GetPreset(config *GetPresetConfig) (Preset, error)

GetPreset is a factory function that, given a configuration, produces a struct that implements the Preset interface based on the name in the configuration. If the string is not recognized an error is returned. This helper function is utilized by both the cli install and upgrade commands.

type QuickstartPreset

type QuickstartPreset struct{}

QuickstartPreset struct is an implementation of the Preset interface that provides a Helm values map that is used during installation and represents the the quickstart configuration for Consul on Kubernetes.

func (*QuickstartPreset) GetValueMap

func (i *QuickstartPreset) GetValueMap() (map[string]interface{}, error)

GetValueMap returns the Helm value map representing the quickstart configuration for Consul on Kubernetes. It does the following: - server replicas equal to 1. - enables the service mesh. - enables the ui. - enables metrics. - enables Prometheus.

type SecurePreset

type SecurePreset struct{}

SecurePreset struct is an implementation of the Preset interface that provides a Helm values map that is used during installation and represents the the quickstart configuration for Consul on Kubernetes.

func (*SecurePreset) GetValueMap

func (i *SecurePreset) GetValueMap() (map[string]interface{}, error)

GetValueMap returns the Helm value map representing the quickstart configuration for Consul on Kubernetes. It does the following: - server replicas equal to 1. - enables the service mesh. - enables tls. - enables gossip encryption. - enables ACLs.

type Tokens

type Tokens struct {
	Agent             string `json:"agent"`
	InitialManagement string `json:"initial_management"`
}

Tokens represents 'cluster.consul_config.acl.tokens' in the response fetched from the agent bootstrap config endpoint in HCP.

Jump to

Keyboard shortcuts

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