cluster

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 9 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 DeleteE2eCluster added in v0.3.8

func DeleteE2eCluster(name string, quiet bool) error

DeleteE2eCluster deletes an existing e2e cluster

func InstallContourIngress

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

InstallContourIngress installs a customized contour ingress

Types

type E2eCluster

type E2eCluster interface {
	// Cleanup deletes the cluster if the auto cleanup option was enabled
	Cleanup() error
	// Delete deletes the cluster regardless of the auto cleanup option setting
	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
	// Load loads the supplied images to the clusters' nodes.
	Load(images ...string) error
}

E2eCluster defines the interface for accessing an e2e cluster

func BuildE2eCluster

func BuildE2eCluster(
	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
	EnvOverride    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 WithEnvOverride added in v0.3.8

func WithEnvOverride(override bool) E2eClusterOption

WithEnvOverride specifies if the cluster configuration can be overridden by environment variables

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 WithImages added in v0.3.8

func WithImages(images ...string) E2eClusterOption

WithImages adds images to the list of images to be pre-loaded into the cluster

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) WithReuse(true) implies WithAutoCleanup(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