clusters

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClusterWithTemporaryKubeconfig

func CreateClusterWithTemporaryKubeconfig(distroToUse DistroToUse) (string, error)

CreateClusterWithTemporaryKubeconfig creates a temporary Kubeconfig file, updates the process's KUBECONFIG env var to point at the new file, and creates a kubernetes cluster. It returns the path to the temporary Kubeconfig file, or an error if something went wrong. The caller is responsible for destroying the cluster and deleting the temporary kubeconfig file. The KUBECONFIG env var doesn't need to be reset since it was only changed for the current process.

func DeleteClusterAndTemporaryKubeconfig

func DeleteClusterAndTemporaryKubeconfig(distroToUse DistroToUse, tempKubeconfigFilePath string) error

DeleteClusterAndTemporaryKubeconfig is intended to be deferred at the end of TestMain execution so we can clean up the cluster and temp file that we made.

func GetClientSet

func GetClientSet() (*kubernetes.Clientset, error)

GetClientSet establishes a connection with the currently configured k8s cluster and returns the ClientSet object that is needed to interact with it.

func GetConfig

func GetConfig() (*rest.Config, error)

GetConfig gets the currently configured Kubeconfig, or throws an error if something went wrong.

func TryValidateClusterIsRunning

func TryValidateClusterIsRunning() error

TryValidateClusterIsRunning establishes a valid connection to the currently configured cluster, then returns, throwing an error if anything went wrong.

Types

type DistroToUse

type DistroToUse int

DistroToUse is an "enum" for helping determine which k8s distro to run the tests on.

const (
	// DistroUnknown is the "enum" representation for when we don't know what distro the user wants.
	DistroUnknown DistroToUse = iota
	// DistroProvided is the "enum" representation for when the user wants to use the k8s cluster that is already present.
	DistroProvided
	// DistroKind is the "enum" representation for when the user wants the test suite to set up its own KinD cluster.
	DistroKind
	// DistroK3d is the "enum" representation for when the user wants the test suite to set up its own K3d cluster.
	DistroK3d
	// DistroK3s is the "enum" representation for when the user wants the test suite to use Zarf's built-in K3s cluster.
	DistroK3s
)

func GetDistroToUseFromString

func GetDistroToUseFromString(s string) (DistroToUse, error)

GetDistroToUseFromString decides which cluster the user wants based on the string value passed from an environment variable.

Jump to

Keyboard shortcuts

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