cluster

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cluster offers helpers for setting a cluster for e2e testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallContourIngress

func InstallContourIngress(ctx context.Context, cluster E2eCluster) error

InstallContourIngress installs a customized contour ingress

Types

type E2eCluster

type E2eCluster interface {
	// Delete deletes the cluster
	Delete() error
	// Ingress returns the url to the cluster's ingress
	Ingress() string
	// Kubeconfig returns the path to the cluster's kubeconfig file
	Kubeconfig() string
	// Name returns the name of the cluster
	Name() string
}

E2eCluster defines the interface for accessing an e2e cluster

func BuildDefaultE2eCluster

func BuildDefaultE2eCluster(t *testing.T) (E2eCluster, error)

BuildDefaultE2eCluster builds an e2e test cluster with the default configuration

func BuildE2eCluster

func BuildE2eCluster(
	t *testing.T,
	e2eConfig E2eClusterConfig,
	ops ...E2eClusterOption,
) (e2ec E2eCluster, err error)

BuildE2eCluster builds a cluster for e2e tests

type E2eClusterConfig

type E2eClusterConfig struct {
	Name           string
	Images         []string
	IngressAddr    string
	IngressPort    int32
	PostInstall    []PostInstall
	Reuse          bool
	Wait           time.Duration
	AutoCleanup    bool
	Kubeconfig     string
	UseEtcdRAMDisk bool
}

E2eClusterConfig defines the configuration of a e2e test cluster

func DefaultE2eClusterConfig

func DefaultE2eClusterConfig() E2eClusterConfig

DefaultE2eClusterConfig builds the default configuration for an e2e test cluster TODO: allow override of default port using an environment variable (E2E_INGRESS_PORT)

type E2eClusterOption

type E2eClusterOption func(E2eClusterConfig) (E2eClusterConfig, error)

E2eClusterOption allows modifying an E2eClusterOption

func WithAutoCleanup added in v0.3.4

func WithAutoCleanup(autoCleanup bool) E2eClusterOption

WithAutoCleanup specifies if the cluster must automatically deleted when test ends

func WithEtcdRAMDisk added in v0.3.4

func WithEtcdRAMDisk(ramdisk bool) E2eClusterOption

WithEtcdRAMDisk specifies if the cluster must be configured to use a RAM disk for Etcd

func WithIngressAddress

func WithIngressAddress(address string) E2eClusterOption

WithIngressAddress sets the ingress address

func WithIngressPort

func WithIngressPort(port int32) E2eClusterOption

WithIngressPort sets the ingress port

func WithKubeconfig added in v0.3.4

func WithKubeconfig(kubeconfig string) E2eClusterOption

WithKubeconfig sets the path to the kubeconfig file

func WithName

func WithName(name string) E2eClusterOption

WithName sets the cluster name

func WithReuse added in v0.3.4

func WithReuse(reuse bool) E2eClusterOption

WithReuse specifies if an existing cluster with the same name must be reused (true) or deleted (false)

func WithWait

func WithWait(timeout time.Duration) E2eClusterOption

WithWait sets the timeout for cluster creation

type PostInstall

type PostInstall func(ctx context.Context, cluster E2eCluster) error

PostInstall defines a function that runs after the cluster is created It can be used for adding components (e.g. addons)

Jump to

Keyboard shortcuts

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