utils

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr added in v0.4.0

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the given bool value.

func DeleteDeploymentsWithPrefix added in v0.3.0

func DeleteDeploymentsWithPrefix(ctx context.Context, clients config.Clients, namespace string, deploymentName string) error

DeleteDeploymentsWithPrefix deletes deployments, starting with a prefix

func DeleteNamespace

func DeleteNamespace(ctx context.Context, clients config.Clients, namespace string) error

DeleteNamespace deletes a namespace

func DeleteNetPolsInNamespace added in v0.3.0

func DeleteNetPolsInNamespace(ctx context.Context, clients config.Clients, namespace string) error

DeleteNetPolsInNamespace deletes network policies in a namespace

func DeletePodsWithLabel added in v0.2.0

func DeletePodsWithLabel(ctx context.Context, clients config.Clients, namespace string, label string) error

DeletePodsWithLabel deletes pods with a particular label

func DeleteServicesWithPrefix added in v0.2.0

func DeleteServicesWithPrefix(ctx context.Context, clients config.Clients, namespace string, serviceNamePrefix string) error

DeleteServicesWithPrefix deletes services starting with a prefix

func ExecCommandInPod

func ExecCommandInPod(ctx context.Context, pod *corev1.Pod, command string, timeout int) (string, string, error)

ExecCommandInPod executes a command in a pod

func GetOrCreateCM

func GetOrCreateCM(ctx context.Context, clients config.Clients, cm corev1.ConfigMap) (corev1.ConfigMap, error)

GetOrCreateCM gets or creates a configMap if it does not exist

func GetOrCreateDS

func GetOrCreateDS(ctx context.Context, clients config.Clients, ds appsv1.DaemonSet) (appsv1.DaemonSet, error)

GetOrCreateDS gets or creates a deployment if it does not exist

func GetOrCreateDeployment

func GetOrCreateDeployment(ctx context.Context, clients config.Clients, deployment appsv1.Deployment) (appsv1.Deployment, error)

GetOrCreateDeployment gets or creates a deployment if it does not exist

func GetOrCreateNS

func GetOrCreateNS(ctx context.Context, clients config.Clients, namespace string) (*corev1.Namespace, error)

GetOrCreateNS gets or creates a namespace if it does not exist

func GetOrCreatePod

func GetOrCreatePod(ctx context.Context, clients config.Clients, pod corev1.Pod) (corev1.Pod, error)

GetOrCreatePod gets or creates a pod if it does not exist

func GetOrCreateSvc

func GetOrCreateSvc(ctx context.Context, clients config.Clients, svc corev1.Service) (corev1.Service, error)

GetOrCreateSvc gets or creates a service if it does not exist

func GetPodLogs added in v0.3.0

func GetPodLogs(ctx context.Context, clients config.Clients, podName string, namespace string) (string, error)

GetPodLogs retrieves logs from a pod

func Int64Ptr added in v0.4.0

func Int64Ptr(i int64) *int64

Int64Ptr returns a pointer to the given int64 value.

func IsPodRunning added in v0.3.0

func IsPodRunning(ctx context.Context, clients config.Clients, pod *corev1.Pod) (bool, error)

IsPodRunning checks if a pod is running

func RandomString

func RandomString(length int) string

RandomString generates a random string of length n

func RetryinPod

func RetryinPod(ctx context.Context, clients config.Clients, pod *corev1.Pod, cmd string, timeout int) (string, string, error)

RetryinPod retries a command in a pod

func SanitizeString

func SanitizeString(s string) string

SanitizeString removes newlines, carriage returns, and periods from a string

func ScaleDeployment

func ScaleDeployment(ctx context.Context, clients config.Clients, deployment appsv1.Deployment, size int32) error

ScaleDeployment scales a deployment

func Shellout added in v0.2.0

func Shellout(command string, retries int) (string, string, error)

Shellout is a function that runs a command in a shell and returns the stdout and stderr

func WaitForDeployment

func WaitForDeployment(ctx context.Context, clients config.Clients, deployment appsv1.Deployment) error

WaitForDeployment waits for a deployment to be ready

func WaitForTestPods

func WaitForTestPods(ctx context.Context, clients config.Clients, namespace string, label string) ([]corev1.Pod, error)

WaitForTestPods waits for test pods to be running and returns them in a slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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