kubernetes

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamespacesMustBeReady

func NamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, namespaces []string, statefulSetNames []string)

NamespacesMustBeReady waits until all Pods are marked Ready. This will cause the test to halt if the specified timeout is exceeded.

func PokeServer

func PokeServer(t *testing.T, client k8sclient.Interface, kubeConfig *rest.Config, clientNamespace, clientPod, protocol, targetHost string, targetPort int32, timeout time.Duration, shouldConnect bool) bool

PokeServer is a utility function that checks if the connection from the provided clientPod in clientNamespace towards the targetHost:targetPort using the provided protocol can be established or not and returns the result based on if the expectation is shouldConnect or !shouldConnect

func RunCommandFromPod added in v0.1.2

func RunCommandFromPod(client k8sclient.Interface, kubeConfig *rest.Config, podNamespace, podName string, cmd []string) (stdout string, stderr string, err error)

RunCommandFromPod is a utility function that runs kubectl exec command on the Pod specified and returns the result.

Types

type Applier

type Applier struct {
	NamespaceLabels map[string]string

	// FS is the filesystem to use when reading manifests.
	FS embed.FS
}

Applier prepares manifests depending on the available options and applies them to the Kubernetes cluster.

func (Applier) MustApplyWithCleanup

func (a Applier) MustApplyWithCleanup(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, location string, cleanup bool)

MustApplyWithCleanup creates or updates Kubernetes resources defined with the provided YAML file and registers a cleanup function for resources it created. Note that this does not remove resources that already existed in the cluster.

Jump to

Keyboard shortcuts

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