Documentation ¶
Index ¶
- Constants
- func CreateK8sSecret(t *testing.T, client kubernetes.Interface, cfg *config.TestConfig, ...)
- type CLICluster
- type Cluster
- type ClusterKind
- type HelmCluster
- func (h *HelmCluster) Create(t *testing.T)
- func (h *HelmCluster) CreatePortForwardTunnel(t *testing.T, remotePort int, release ...string) string
- func (h *HelmCluster) Destroy(t *testing.T)
- func (h *HelmCluster) SetupConsulClient(t *testing.T, secure bool, release ...string) (client *api.Client, configAddress string)
- func (h *HelmCluster) Upgrade(t *testing.T, helmValues map[string]string)
Constants ¶
const (
CLIReleaseName = "consul"
)
Variables ¶
This section is empty.
Functions ¶
func CreateK8sSecret ¶
func CreateK8sSecret(t *testing.T, client kubernetes.Interface, cfg *config.TestConfig, namespace, secretName, secretKey, secret string)
Types ¶
type CLICluster ¶
type CLICluster struct {
// contains filtered or unexported fields
}
CLICluster.
func NewCLICluster ¶
func NewCLICluster( t *testing.T, helmValues map[string]string, ctx environment.TestContext, cfg *config.TestConfig, releaseName string, ) *CLICluster
NewCLICluster creates a new Consul cluster struct which can be used to create and destroy a Consul cluster using the Consul K8s CLI.
func (*CLICluster) CLI ¶
func (c *CLICluster) CLI() cli.CLI
func (*CLICluster) Create ¶
func (c *CLICluster) Create(t *testing.T)
Create uses the `consul-k8s install` command to create a Consul cluster. The command itself will fail if there are prior installations of Consul in the cluster so it is sufficient to run the install command without a pre-check.
func (*CLICluster) Destroy ¶
func (c *CLICluster) Destroy(t *testing.T)
Destroy uses the `consul-k8s uninstall` command to destroy a Consul cluster.
func (*CLICluster) SetupConsulClient ¶
type Cluster ¶
type Cluster interface { // SetupConsulClient returns a new Consul client. SetupConsulClient(t *testing.T, secure bool, release ...string) (*api.Client, string) // Create creates a new Consul Cluster. Create(t *testing.T) // Upgrade modifies the cluster in-place by merging the helm values // from the initial install with helmValues. Any keys that were previously set // will be overridden by the helmValues keys. Upgrade(t *testing.T, helmValues map[string]string) // Destroy destroys the cluster Destroy(t *testing.T) }
Cluster represents a consul cluster object.
type ClusterKind ¶
type ClusterKind int
ClusterKind represents the kind of Consul cluster being used (e.g. "Helm" or "CLI").
const ( Helm ClusterKind = iota CLI )
type HelmCluster ¶
type HelmCluster struct { // ACLToken is an optional ACL token that will be used to create // a Consul API client. If not provided, we will attempt to read // a bootstrap token from a Kubernetes secret stored in the cluster. ACLToken string // SkipCheckForPreviousInstallations is a toggle for skipping the check // if there are any previous installations of this Helm chart in the cluster. SkipCheckForPreviousInstallations bool // ChartPath is an option field that allows consumers to change the default // chart path if so desired ChartPath string // contains filtered or unexported fields }
HelmCluster implements Cluster and uses Helm to create, destroy, and upgrade consul.
func NewHelmCluster ¶
func NewHelmCluster( t *testing.T, helmValues map[string]string, ctx environment.TestContext, cfg *config.TestConfig, releaseName string, ) *HelmCluster
func (*HelmCluster) Create ¶
func (h *HelmCluster) Create(t *testing.T)
func (*HelmCluster) CreatePortForwardTunnel ¶
func (h *HelmCluster) CreatePortForwardTunnel(t *testing.T, remotePort int, release ...string) string
CreatePortForwardTunnel returns the local address:port of a tunnel to the consul server pod in the given release.
func (*HelmCluster) Destroy ¶
func (h *HelmCluster) Destroy(t *testing.T)