k8s

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 44 Imported by: 185

Documentation

Overview

Package k8s provides common functionalities for interacting with a Kubernetes cluster in the context of infrastructure testing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoAvailableContexts is returned when there are no kubectl contexts remaining after deletion.
	ErrNoAvailableContexts = errors.New("no available contexts remaining")

	// ErrNoNodesAvailable is returned when the Kubernetes cluster reports no nodes.
	ErrNoNodesAvailable = errors.New("no nodes available")

	// ErrNotAllNodesReady is returned when not every node in the cluster is in the Ready state.
	ErrNotAllNodesReady = errors.New("not all nodes ready")

	// ErrNilPod is returned when a nil pod is passed to a function that requires a non-nil pod.
	ErrNilPod = errors.New("cannot get port for pod which is nil")
)

Sentinel errors for conditions that can be checked with errors.Is.

Functions

func AddConfigContextForServiceAccountE added in v0.13.24

func AddConfigContextForServiceAccountE(
	t testing.TestingT,
	kubectlOptions *KubectlOptions,
	contextName string,
	serviceAccountName string,
	token string,
) error

AddConfigContextForServiceAccountE will add a new config context that binds the ServiceAccount auth token to the Kubernetes cluster of the current config context.

func AreAllNodesReady deprecated

func AreAllNodesReady(t testing.TestingT, options *KubectlOptions) bool

AreAllNodesReady checks if all nodes are ready in the Kubernetes cluster targeted by the current config context

Deprecated: Use AreAllNodesReadyContextE instead.

func AreAllNodesReadyContextE added in v1.0.0

func AreAllNodesReadyContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions) (bool, error)

AreAllNodesReadyContextE checks if all nodes are ready in the Kubernetes cluster targeted by the current config context. The ctx parameter supports cancellation and timeouts. If false, returns an error indicating the reason.

func AreAllNodesReadyE deprecated

func AreAllNodesReadyE(t testing.TestingT, options *KubectlOptions) (bool, error)

AreAllNodesReadyE checks if all nodes are ready in the Kubernetes cluster targeted by the current config context. If false, returns an error indicating the reason.

Deprecated: Use AreAllNodesReadyContextE instead.

func CanIDo deprecated added in v0.13.24

func CanIDo(t testing.TestingT, options *KubectlOptions, action authv1.ResourceAttributes) bool

CanIDo returns whether or not the provided action is allowed by the client configured by the provided kubectl option. This will fail if there are any errors accessing the kubernetes API (but not if the action is denied).

Deprecated: Use CanIDoContext instead.

func CanIDoContext added in v1.0.0

func CanIDoContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, action authv1.ResourceAttributes) bool

CanIDoContext returns whether or not the provided action is allowed by the client configured by the provided kubectl option. The ctx parameter supports cancellation and timeouts. This will fail if there are any errors accessing the kubernetes API (but not if the action is denied).

func CanIDoContextE added in v1.0.0

func CanIDoContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, action authv1.ResourceAttributes) (bool, error)

CanIDoContextE returns whether or not the provided action is allowed by the client configured by the provided kubectl option. This will return an error if there are problems accessing the kubernetes API (but not if the action is simply denied). The ctx parameter supports cancellation and timeouts.

func CanIDoE deprecated added in v0.13.24

func CanIDoE(t testing.TestingT, options *KubectlOptions, action authv1.ResourceAttributes) (bool, error)

CanIDoE returns whether or not the provided action is allowed by the client configured by the provided kubectl option. This will an error if there are problems accessing the kubernetes API (but not if the action is simply denied).

Deprecated: Use CanIDoContextE instead.

func CopyHomeKubeConfigToTemp added in v0.13.24

func CopyHomeKubeConfigToTemp(t testing.TestingT) string

CopyHomeKubeConfigToTemp will copy the kubeconfig in the home directory to a temp file. This will fail the test if there are any errors.

func CopyHomeKubeConfigToTempE added in v0.13.24

func CopyHomeKubeConfigToTempE(t testing.TestingT) (string, error)

CopyHomeKubeConfigToTempE will copy the kubeconfig in the home directory to a temp file.

func CreateJobFromCronJob deprecated added in v0.56.0

func CreateJobFromCronJob(t testing.TestingT, options *KubectlOptions, cronJobName, newJobName string) *batchv1.Job

CreateJobFromCronJob creates a Job from the specified CronJob in the given namespace and returns the created Job.

Deprecated: Use CreateJobFromCronJobContext instead.

func CreateJobFromCronJobContext added in v1.0.0

func CreateJobFromCronJobContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName, newJobName string) *batchv1.Job

CreateJobFromCronJobContext creates a Job from the specified CronJob in the given namespace and returns the created Job. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func CreateJobFromCronJobContextE added in v1.0.0

func CreateJobFromCronJobContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName, newJobName string) (*batchv1.Job, error)

CreateJobFromCronJobContextE creates a Job from the specified CronJob in the given namespace and returns the created Job. The ctx parameter supports cancellation and timeouts. This function is similar to running `kubectl create job --from=cronjob/<cron-job-name> <new-job-name>`.

func CreateJobFromCronJobE deprecated added in v0.56.0

func CreateJobFromCronJobE(t testing.TestingT, options *KubectlOptions, cronJobName, newJobName string) (*batchv1.Job, error)

CreateJobFromCronJobE creates a Job from the specified CronJob in the given namespace and returns the created Job. This function is similar to running `kubectl create job --from=cronjob/<cron-job-name> <new-job-name>`.

Deprecated: Use CreateJobFromCronJobContextE instead.

func CreateNamespace deprecated added in v0.13.16

func CreateNamespace(t testing.TestingT, options *KubectlOptions, namespaceName string)

CreateNamespace will create a new Kubernetes namespace on the cluster targeted by the provided options. This will fail the test if there is an error in creating the namespace.

Deprecated: Use CreateNamespaceContext instead.

func CreateNamespaceContext added in v1.0.0

func CreateNamespaceContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string)

CreateNamespaceContext will create a new Kubernetes namespace on the cluster targeted by the provided options. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error in creating the namespace.

func CreateNamespaceContextE added in v1.0.0

func CreateNamespaceContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string) error

CreateNamespaceContextE will create a new Kubernetes namespace on the cluster targeted by the provided options. The ctx parameter supports cancellation and timeouts.

func CreateNamespaceE deprecated added in v0.13.16

func CreateNamespaceE(t testing.TestingT, options *KubectlOptions, namespaceName string) error

CreateNamespaceE will create a new Kubernetes namespace on the cluster targeted by the provided options.

Deprecated: Use CreateNamespaceContextE instead.

func CreateNamespaceWithMetadata deprecated added in v0.32.3

func CreateNamespaceWithMetadata(t testing.TestingT, options *KubectlOptions, namespaceObjectMeta metav1.ObjectMeta)

CreateNamespaceWithMetadata will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata. This method expects the entire namespace ObjectMeta to be passed in, so you'll need to set the name within the ObjectMeta struct yourself. This will fail the test if there is an error while creating the namespace.

Deprecated: Use CreateNamespaceWithMetadataContext instead.

func CreateNamespaceWithMetadataContext added in v1.0.0

func CreateNamespaceWithMetadataContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceObjectMeta metav1.ObjectMeta)

CreateNamespaceWithMetadataContext will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error while creating the namespace.

func CreateNamespaceWithMetadataContextE added in v1.0.0

func CreateNamespaceWithMetadataContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceObjectMeta metav1.ObjectMeta) error

CreateNamespaceWithMetadataContextE will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata. The ctx parameter supports cancellation and timeouts. This method expects the entire namespace ObjectMeta to be passed in, so you'll need to set the name within the ObjectMeta struct yourself.

func CreateNamespaceWithMetadataE deprecated added in v0.32.3

func CreateNamespaceWithMetadataE(t testing.TestingT, options *KubectlOptions, namespaceObjectMeta metav1.ObjectMeta) error

CreateNamespaceWithMetadataE will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata. This method expects the entire namespace ObjectMeta to be passed in, so you'll need to set the name within the ObjectMeta struct yourself.

Deprecated: Use CreateNamespaceWithMetadataContextE instead.

func CreateServiceAccount deprecated added in v0.13.22

func CreateServiceAccount(t testing.TestingT, options *KubectlOptions, serviceAccountName string)

CreateServiceAccount will create a new service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use CreateServiceAccountContext instead.

func CreateServiceAccountContext added in v1.0.0

func CreateServiceAccountContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceAccountName string)

CreateServiceAccountContext will create a new service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func CreateServiceAccountContextE added in v1.0.0

func CreateServiceAccountContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceAccountName string) error

CreateServiceAccountContextE will create a new service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func CreateServiceAccountE deprecated added in v0.13.22

func CreateServiceAccountE(t testing.TestingT, options *KubectlOptions, serviceAccountName string) error

CreateServiceAccountE will create a new service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use CreateServiceAccountContextE instead.

func DeleteConfigContextE

func DeleteConfigContextE(t testing.TestingT, contextName string) error

DeleteConfigContextE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it. The config path is either specified in the environment variable KUBECONFIG or at the user's home directory under `.kube/config`.

func DeleteConfigContextWithPathE

func DeleteConfigContextWithPathE(t testing.TestingT, kubeConfigPath string, contextName string) error

DeleteConfigContextWithPathE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it.

func DeleteNamespace deprecated added in v0.13.16

func DeleteNamespace(t testing.TestingT, options *KubectlOptions, namespaceName string)

DeleteNamespace will delete the requested namespace from the Kubernetes cluster targeted by the provided options. This will fail the test if there is an error in creating the namespace.

Deprecated: Use DeleteNamespaceContext instead.

func DeleteNamespaceContext added in v1.0.0

func DeleteNamespaceContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string)

DeleteNamespaceContext will delete the requested namespace from the Kubernetes cluster targeted by the provided options. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func DeleteNamespaceContextE added in v1.0.0

func DeleteNamespaceContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string) error

DeleteNamespaceContextE will delete the requested namespace from the Kubernetes cluster targeted by the provided options. The ctx parameter supports cancellation and timeouts.

func DeleteNamespaceE deprecated added in v0.13.16

func DeleteNamespaceE(t testing.TestingT, options *KubectlOptions, namespaceName string) error

DeleteNamespaceE will delete the requested namespace from the Kubernetes cluster targeted by the provided options.

Deprecated: Use DeleteNamespaceContextE instead.

func ExecPod deprecated added in v0.52.0

func ExecPod(t testing.TestingT, options *KubectlOptions, podName string, containerName string, command ...string) string

ExecPod executes a command in a container within a Kubernetes pod and returns the output. This will fail the test if there is an error. Set containerName to "" if there is only one container in the pod.

Deprecated: Use ExecPodContext instead.

func ExecPodContext added in v1.0.0

func ExecPodContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string, containerName string, command ...string) string

ExecPodContext executes a command in a container within a Kubernetes pod and returns the output. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error. Set containerName to "" if there is only one container in the pod.

func ExecPodContextE added in v1.0.0

func ExecPodContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string, containerName string, command ...string) (string, error)

ExecPodContextE executes a command in a container within a Kubernetes pod and returns the output. The ctx parameter supports cancellation and timeouts. Set containerName to "" if there is only one container in the pod.

func ExecPodE deprecated added in v0.52.0

func ExecPodE(t testing.TestingT, options *KubectlOptions, podName string, containerName string, command ...string) (string, error)

ExecPodE executes a command in a container within a Kubernetes pod and returns the output. Set containerName to "" if there is only one container in the pod.

Deprecated: Use ExecPodContextE instead.

func FindNodeHostnameContext added in v1.0.0

func FindNodeHostnameContext(t testing.TestingT, ctx context.Context, node corev1.Node) string

FindNodeHostnameContext returns the hostname or IP address of the given node using the provided context, preferring the external IP when available. This will fail the test if there is an error.

func FindNodeHostnameContextE added in v1.0.0

func FindNodeHostnameContextE(t testing.TestingT, ctx context.Context, node corev1.Node) (string, error)

FindNodeHostnameContextE returns the hostname or IP address of the given node using the provided context, preferring the external IP when available.

func FindNodeHostnameE deprecated added in v0.17.5

func FindNodeHostnameE(t testing.TestingT, node corev1.Node) (string, error)

FindNodeHostnameE returns the hostname or IP address of the given node, preferring the external IP when available.

Deprecated: Use FindNodeHostnameContextE instead.

func FindNodePortContext added in v1.0.0

func FindNodePortContext(t testing.TestingT, ctx context.Context, service *corev1.Service, servicePort int32) int32

FindNodePortContext returns the allocated NodePort for the given servicePort from the service definition. The ctx parameter is accepted for API consistency but is not used since this is a local struct lookup. This will fail the test if there is an error.

func FindNodePortContextE added in v1.0.0

func FindNodePortContextE(_ context.Context, service *corev1.Service, servicePort int32) (int32, error)

FindNodePortContextE returns the allocated NodePort for the given servicePort from the service definition. The ctx parameter is accepted for API consistency but is not used since this is a local struct lookup.

func FindNodePortE deprecated added in v0.17.5

func FindNodePortE(service *corev1.Service, servicePort int32) (int32, error)

FindNodePortE returns the allocated NodePort for the given servicePort from the service definition.

Deprecated: Use FindNodePortContextE instead.

func GetAvailablePort deprecated added in v0.13.28

func GetAvailablePort(t testing.TestingT) int

GetAvailablePort retrieves an available port on the host machine. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using. This will fail the test if it could not find an available port.

Deprecated: Use GetAvailablePortContext instead.

func GetAvailablePortContext added in v1.0.0

func GetAvailablePortContext(t testing.TestingT, ctx context.Context) int

GetAvailablePortContext retrieves an available port on the host machine using the provided context. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using. This will fail the test if it could not find an available port.

func GetAvailablePortContextE added in v1.0.0

func GetAvailablePortContextE(t testing.TestingT, ctx context.Context) (int, error)

GetAvailablePortContextE retrieves an available port on the host machine using the provided context. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using.

func GetAvailablePortE deprecated added in v0.13.28

func GetAvailablePortE(t testing.TestingT) (int, error)

GetAvailablePortE retrieves an available port on the host machine. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using.

Deprecated: Use GetAvailablePortContextE instead.

func GetClusterRole deprecated added in v0.13.30

func GetClusterRole(t testing.TestingT, options *KubectlOptions, roleName string) *rbacv1.ClusterRole

GetClusterRole returns a Kubernetes ClusterRole resource with the given name. This will fail the test if there is an error.

Deprecated: Use GetClusterRoleContext instead.

func GetClusterRoleContext added in v1.0.0

func GetClusterRoleContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, roleName string) *rbacv1.ClusterRole

GetClusterRoleContext returns a Kubernetes ClusterRole resource with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetClusterRoleContextE added in v1.0.0

func GetClusterRoleContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, roleName string) (*rbacv1.ClusterRole, error)

GetClusterRoleContextE returns a Kubernetes ClusterRole resource with the given name. The ctx parameter supports cancellation and timeouts.

func GetClusterRoleE deprecated added in v0.13.30

func GetClusterRoleE(t testing.TestingT, options *KubectlOptions, roleName string) (*rbacv1.ClusterRole, error)

GetClusterRoleE returns a Kubernetes ClusterRole resource with the given name.

Deprecated: Use GetClusterRoleContextE instead.

func GetConfigMap deprecated added in v0.41.6

func GetConfigMap(t testing.TestingT, options *KubectlOptions, configMapName string) *corev1.ConfigMap

GetConfigMap returns a Kubernetes configmap resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use GetConfigMapContext instead.

func GetConfigMapContext added in v1.0.0

func GetConfigMapContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configMapName string) *corev1.ConfigMap

GetConfigMapContext returns a Kubernetes configmap resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetConfigMapContextE added in v1.0.0

func GetConfigMapContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configMapName string) (*corev1.ConfigMap, error)

GetConfigMapContextE returns a Kubernetes configmap resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func GetConfigMapE deprecated added in v0.41.6

func GetConfigMapE(t testing.TestingT, options *KubectlOptions, configMapName string) (*corev1.ConfigMap, error)

GetConfigMapE returns a Kubernetes configmap resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use GetConfigMapContextE instead.

func GetCronJob deprecated added in v0.50.0

func GetCronJob(t testing.TestingT, options *KubectlOptions, cronJobName string) *batchv1.CronJob

GetCronJob return cron job resource from namespace by name. This will fail the test if there is an error.

Deprecated: Use GetCronJobContext instead.

func GetCronJobContext added in v1.0.0

func GetCronJobContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName string) *batchv1.CronJob

GetCronJobContext returns a cron job resource from namespace by name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetCronJobContextE added in v1.0.0

func GetCronJobContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName string) (*batchv1.CronJob, error)

GetCronJobContextE returns a cron job resource from namespace by name. The ctx parameter supports cancellation and timeouts.

func GetCronJobE deprecated added in v0.50.0

func GetCronJobE(t testing.TestingT, options *KubectlOptions, cronJobName string) (*batchv1.CronJob, error)

GetCronJobE return cron job resource from namespace by name. This will return cron job or error.

Deprecated: Use GetCronJobContextE instead.

func GetDaemonSet deprecated added in v0.19.6

func GetDaemonSet(t testing.TestingT, options *KubectlOptions, daemonSetName string) *appsv1.DaemonSet

GetDaemonSet returns a Kubernetes daemonset resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetDaemonSetContext instead.

func GetDaemonSetContext added in v1.0.0

func GetDaemonSetContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, daemonSetName string) *appsv1.DaemonSet

GetDaemonSetContext returns a Kubernetes daemonset resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetDaemonSetContextE added in v1.0.0

func GetDaemonSetContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, daemonSetName string) (*appsv1.DaemonSet, error)

GetDaemonSetContextE returns a Kubernetes daemonset resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetDaemonSetE deprecated added in v0.19.6

func GetDaemonSetE(t testing.TestingT, options *KubectlOptions, daemonSetName string) (*appsv1.DaemonSet, error)

GetDaemonSetE returns a Kubernetes daemonset resource in the provided namespace with the given name.

Deprecated: Use GetDaemonSetContextE instead.

func GetDeployment deprecated added in v0.41.21

func GetDeployment(t testing.TestingT, options *KubectlOptions, deploymentName string) *appsv1.Deployment

GetDeployment returns a Kubernetes deployment resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetDeploymentContext instead.

func GetDeploymentContext added in v1.0.0

func GetDeploymentContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, deploymentName string) *appsv1.Deployment

GetDeploymentContext returns a Kubernetes deployment resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetDeploymentContextE added in v1.0.0

func GetDeploymentContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, deploymentName string) (*appsv1.Deployment, error)

GetDeploymentContextE returns a Kubernetes deployment resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetDeploymentE deprecated added in v0.41.21

func GetDeploymentE(t testing.TestingT, options *KubectlOptions, deploymentName string) (*appsv1.Deployment, error)

GetDeploymentE returns a Kubernetes deployment resource in the provided namespace with the given name.

Deprecated: Use GetDeploymentContextE instead.

func GetIngress deprecated added in v0.14.5

func GetIngress(t testing.TestingT, options *KubectlOptions, ingressName string) *networkingv1.Ingress

GetIngress returns a Kubernetes Ingress resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetIngressContext instead.

func GetIngressContext added in v1.0.0

func GetIngressContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string) *networkingv1.Ingress

GetIngressContext returns a Kubernetes Ingress resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetIngressContextE added in v1.0.0

func GetIngressContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string) (*networkingv1.Ingress, error)

GetIngressContextE returns a Kubernetes Ingress resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetIngressE deprecated added in v0.14.5

func GetIngressE(t testing.TestingT, options *KubectlOptions, ingressName string) (*networkingv1.Ingress, error)

GetIngressE returns a Kubernetes Ingress resource in the provided namespace with the given name.

Deprecated: Use GetIngressContextE instead.

func GetIngressV1Beta1 deprecated added in v0.34.0

func GetIngressV1Beta1(t testing.TestingT, options *KubectlOptions, ingressName string) *networkingv1beta1.Ingress

GetIngressV1Beta1 returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1 API. This will fail the test if there is an error.

Deprecated: Use GetIngressV1Beta1Context instead.

func GetIngressV1Beta1Context added in v1.0.0

func GetIngressV1Beta1Context(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string) *networkingv1beta1.Ingress

GetIngressV1Beta1Context returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetIngressV1Beta1ContextE added in v1.0.0

func GetIngressV1Beta1ContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string) (*networkingv1beta1.Ingress, error)

GetIngressV1Beta1ContextE returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts.

func GetIngressV1Beta1E deprecated added in v0.34.0

func GetIngressV1Beta1E(t testing.TestingT, options *KubectlOptions, ingressName string) (*networkingv1beta1.Ingress, error)

GetIngressV1Beta1E returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1.

Deprecated: Use GetIngressV1Beta1ContextE instead.

func GetJob deprecated added in v0.36.7

func GetJob(t testing.TestingT, options *KubectlOptions, jobName string) *batchv1.Job

GetJob returns a Kubernetes job resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetJobContext instead.

func GetJobContext added in v1.0.0

func GetJobContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, jobName string) *batchv1.Job

GetJobContext returns a Kubernetes job resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetJobContextE added in v1.0.0

func GetJobContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, jobName string) (*batchv1.Job, error)

GetJobContextE returns a Kubernetes job resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetJobE deprecated added in v0.36.7

func GetJobE(t testing.TestingT, options *KubectlOptions, jobName string) (*batchv1.Job, error)

GetJobE returns a Kubernetes job resource in the provided namespace with the given name.

Deprecated: Use GetJobContextE instead.

func GetKubeConfigPathContext added in v1.0.0

func GetKubeConfigPathContext(t testing.TestingT, ctx context.Context) string

GetKubeConfigPathContext determines which file path to use as the kubectl config path. The ctx parameter is accepted for API consistency. This will fail the test if there is an error.

func GetKubeConfigPathContextE added in v1.0.0

func GetKubeConfigPathContextE(t testing.TestingT, ctx context.Context) (string, error)

GetKubeConfigPathContextE determines which file path to use as the kubectl config path. The ctx parameter is accepted for API consistency.

func GetKubeConfigPathE deprecated

func GetKubeConfigPathE(t testing.TestingT) (string, error)

GetKubeConfigPathE determines which file path to use as the kubectl config path

Deprecated: Use GetKubeConfigPathContextE instead.

func GetKubernetesClientContext added in v1.0.0

func GetKubernetesClientContext(t testing.TestingT, ctx context.Context) *kubernetes.Clientset

GetKubernetesClientContext returns a Kubernetes API client that can be used to make requests. The ctx parameter is accepted for API consistency. This will fail the test if there is an error.

func GetKubernetesClientContextE added in v1.0.0

func GetKubernetesClientContextE(t testing.TestingT, ctx context.Context) (*kubernetes.Clientset, error)

GetKubernetesClientContextE returns a Kubernetes API client that can be used to make requests. The ctx parameter is accepted for API consistency.

func GetKubernetesClientE deprecated

func GetKubernetesClientE(t testing.TestingT) (*kubernetes.Clientset, error)

GetKubernetesClientE returns a Kubernetes API client that can be used to make requests.

Deprecated: Use GetKubernetesClientContextE instead.

func GetKubernetesClientFromOptionsContext added in v1.0.0

func GetKubernetesClientFromOptionsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions) *kubernetes.Clientset

GetKubernetesClientFromOptionsContext returns a Kubernetes API client given a configured KubectlOptions object. The ctx parameter is accepted for API consistency. This will fail the test if there is an error.

func GetKubernetesClientFromOptionsContextE added in v1.0.0

func GetKubernetesClientFromOptionsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions) (*kubernetes.Clientset, error)

GetKubernetesClientFromOptionsContextE returns a Kubernetes API client given a configured KubectlOptions object. The ctx parameter is accepted for API consistency.

func GetKubernetesClientFromOptionsE deprecated added in v0.13.16

func GetKubernetesClientFromOptionsE(t testing.TestingT, options *KubectlOptions) (*kubernetes.Clientset, error)

GetKubernetesClientFromOptionsE returns a Kubernetes API client given a configured KubectlOptions object.

Deprecated: Use GetKubernetesClientFromOptionsContextE instead.

func GetKubernetesClusterVersionContext added in v1.0.0

func GetKubernetesClusterVersionContext(t testing.TestingT, ctx context.Context) string

GetKubernetesClusterVersionContext returns the Kubernetes cluster version. The ctx parameter is accepted for API consistency. This will fail the test if there is an error.

func GetKubernetesClusterVersionContextE added in v1.0.0

func GetKubernetesClusterVersionContextE(t testing.TestingT, ctx context.Context) (string, error)

GetKubernetesClusterVersionContextE returns the Kubernetes cluster version. The ctx parameter is accepted for API consistency.

func GetKubernetesClusterVersionE deprecated added in v0.34.8

func GetKubernetesClusterVersionE(t testing.TestingT) (string, error)

GetKubernetesClusterVersionE returns the Kubernetes cluster version.

Deprecated: Use GetKubernetesClusterVersionContextE instead.

func GetKubernetesClusterVersionWithOptionsContext added in v1.0.0

func GetKubernetesClusterVersionWithOptionsContext(t testing.TestingT, ctx context.Context, kubectlOptions *KubectlOptions) string

GetKubernetesClusterVersionWithOptionsContext returns the Kubernetes cluster version given a configured KubectlOptions object. The ctx parameter is accepted for API consistency. This will fail the test if there is an error.

func GetKubernetesClusterVersionWithOptionsContextE added in v1.0.0

func GetKubernetesClusterVersionWithOptionsContextE(t testing.TestingT, ctx context.Context, kubectlOptions *KubectlOptions) (string, error)

GetKubernetesClusterVersionWithOptionsContextE returns the Kubernetes cluster version given a configured KubectlOptions object. The ctx parameter is accepted for API consistency.

func GetKubernetesClusterVersionWithOptionsE deprecated added in v0.34.8

func GetKubernetesClusterVersionWithOptionsE(t testing.TestingT, kubectlOptions *KubectlOptions) (string, error)

GetKubernetesClusterVersionWithOptionsE returns the Kubernetes cluster version given a configured KubectlOptions object.

Deprecated: Use GetKubernetesClusterVersionWithOptionsContextE instead.

func GetNamespace deprecated added in v0.13.16

func GetNamespace(t testing.TestingT, options *KubectlOptions, namespaceName string) *corev1.Namespace

GetNamespace will query the Kubernetes cluster targeted by the provided options for the requested namespace. This will fail the test if there is an error in getting the namespace or if the namespace doesn't exist.

Deprecated: Use GetNamespaceContext instead.

func GetNamespaceContext added in v1.0.0

func GetNamespaceContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string) *corev1.Namespace

GetNamespaceContext will query the Kubernetes cluster targeted by the provided options for the requested namespace. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error or if the namespace doesn't exist.

func GetNamespaceContextE added in v1.0.0

func GetNamespaceContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, namespaceName string) (*corev1.Namespace, error)

GetNamespaceContextE will query the Kubernetes cluster targeted by the provided options for the requested namespace. The ctx parameter supports cancellation and timeouts.

func GetNamespaceE deprecated added in v0.13.16

func GetNamespaceE(t testing.TestingT, options *KubectlOptions, namespaceName string) (*corev1.Namespace, error)

GetNamespaceE will query the Kubernetes cluster targeted by the provided options for the requested namespace.

Deprecated: Use GetNamespaceContextE instead.

func GetNetworkPolicy deprecated added in v0.41.4

func GetNetworkPolicy(t testing.TestingT, options *KubectlOptions, networkPolicyName string) *networkingv1.NetworkPolicy

GetNetworkPolicy returns a Kubernetes networkpolicy resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use GetNetworkPolicyContext instead.

func GetNetworkPolicyContext added in v1.0.0

func GetNetworkPolicyContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, networkPolicyName string) *networkingv1.NetworkPolicy

GetNetworkPolicyContext returns a Kubernetes networkpolicy resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetNetworkPolicyContextE added in v1.0.0

func GetNetworkPolicyContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, networkPolicyName string) (*networkingv1.NetworkPolicy, error)

GetNetworkPolicyContextE returns a Kubernetes networkpolicy resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func GetNetworkPolicyE deprecated added in v0.41.4

func GetNetworkPolicyE(t testing.TestingT, options *KubectlOptions, networkPolicyName string) (*networkingv1.NetworkPolicy, error)

GetNetworkPolicyE returns a Kubernetes networkpolicy resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use GetNetworkPolicyContextE instead.

func GetNodes deprecated

func GetNodes(t testing.TestingT, options *KubectlOptions) []corev1.Node

GetNodes queries Kubernetes for information about the worker nodes registered to the cluster. If anything goes wrong, the function will automatically fail the test.

Deprecated: Use GetNodesContext instead.

func GetNodesByFilterContext added in v1.0.0

func GetNodesByFilterContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filter metav1.ListOptions) []corev1.Node

GetNodesByFilterContext queries Kubernetes for information about the worker nodes registered to the cluster, filtering the list of nodes using the provided ListOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetNodesByFilterContextE added in v1.0.0

func GetNodesByFilterContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filter metav1.ListOptions) ([]corev1.Node, error)

GetNodesByFilterContextE queries Kubernetes for information about the worker nodes registered to the cluster, filtering the list of nodes using the provided ListOptions. The ctx parameter supports cancellation and timeouts.

func GetNodesByFilterE deprecated added in v0.17.5

func GetNodesByFilterE(t testing.TestingT, options *KubectlOptions, filter metav1.ListOptions) ([]corev1.Node, error)

GetNodesByFilterE queries Kubernetes for information about the worker nodes registered to the cluster, filtering the list of nodes using the provided ListOptions.

Deprecated: Use GetNodesByFilterContextE instead.

func GetNodesContext added in v1.0.0

func GetNodesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions) []corev1.Node

GetNodesContext queries Kubernetes for information about the worker nodes registered to the cluster. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetNodesContextE added in v1.0.0

func GetNodesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions) ([]corev1.Node, error)

GetNodesContextE queries Kubernetes for information about the worker nodes registered to the cluster. The ctx parameter supports cancellation and timeouts.

func GetNodesE deprecated

func GetNodesE(t testing.TestingT, options *KubectlOptions) ([]corev1.Node, error)

GetNodesE queries Kubernetes for information about the worker nodes registered to the cluster.

Deprecated: Use GetNodesContextE instead.

func GetPersistentVolume deprecated added in v0.41.24

func GetPersistentVolume(t testing.TestingT, options *KubectlOptions, name string) *corev1.PersistentVolume

GetPersistentVolume returns a Kubernetes PersistentVolume resource with the given name. This will fail the test if there is an error.

Deprecated: Use GetPersistentVolumeContext instead.

func GetPersistentVolumeClaim deprecated added in v0.41.25

func GetPersistentVolumeClaim(t testing.TestingT, options *KubectlOptions, pvcName string) *corev1.PersistentVolumeClaim

GetPersistentVolumeClaim returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetPersistentVolumeClaimContext instead.

func GetPersistentVolumeClaimContext added in v1.0.0

func GetPersistentVolumeClaimContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, pvcName string) *corev1.PersistentVolumeClaim

GetPersistentVolumeClaimContext returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetPersistentVolumeClaimContextE added in v1.0.0

func GetPersistentVolumeClaimContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, pvcName string) (*corev1.PersistentVolumeClaim, error)

GetPersistentVolumeClaimContextE returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetPersistentVolumeClaimE deprecated added in v0.41.25

func GetPersistentVolumeClaimE(t testing.TestingT, options *KubectlOptions, pvcName string) (*corev1.PersistentVolumeClaim, error)

GetPersistentVolumeClaimE returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name.

Deprecated: Use GetPersistentVolumeClaimContextE instead.

func GetPersistentVolumeContext added in v1.0.0

func GetPersistentVolumeContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, name string) *corev1.PersistentVolume

GetPersistentVolumeContext returns a Kubernetes PersistentVolume resource with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetPersistentVolumeContextE added in v1.0.0

func GetPersistentVolumeContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, name string) (*corev1.PersistentVolume, error)

GetPersistentVolumeContextE returns a Kubernetes PersistentVolume resource with the given name. The ctx parameter supports cancellation and timeouts.

func GetPersistentVolumeE deprecated added in v0.41.24

func GetPersistentVolumeE(t testing.TestingT, options *KubectlOptions, name string) (*corev1.PersistentVolume, error)

GetPersistentVolumeE returns a Kubernetes PersistentVolume resource with the given name.

Deprecated: Use GetPersistentVolumeContextE instead.

func GetPod deprecated added in v0.13.21

func GetPod(t testing.TestingT, options *KubectlOptions, podName string) *corev1.Pod

GetPod returns a Kubernetes pod resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetPodContext instead.

func GetPodContext added in v1.0.0

func GetPodContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string) *corev1.Pod

GetPodContext returns a Kubernetes pod resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetPodContextE added in v1.0.0

func GetPodContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string) (*corev1.Pod, error)

GetPodContextE returns a Kubernetes pod resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetPodE deprecated added in v0.13.21

func GetPodE(t testing.TestingT, options *KubectlOptions, podName string) (*corev1.Pod, error)

GetPodE returns a Kubernetes pod resource in the provided namespace with the given name.

Deprecated: Use GetPodContextE instead.

func GetPodLogs deprecated added in v0.41.10

func GetPodLogs(t testing.TestingT, options *KubectlOptions, pod *corev1.Pod, containerName string) string

GetPodLogs returns the logs of a Pod at the time when the function was called. Pass container name if there are more containers in the Pod or set to "" if there is only one.

Deprecated: Use GetPodLogsContext instead.

func GetPodLogsContext added in v1.0.0

func GetPodLogsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, pod *corev1.Pod, containerName string) string

GetPodLogsContext returns the logs of a Pod at the time when the function was called. The ctx parameter supports cancellation and timeouts. Pass container name if there are more containers in the Pod or set to "" if there is only one. This will fail the test if there is an error.

func GetPodLogsContextE added in v1.0.0

func GetPodLogsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, pod *corev1.Pod, containerName string) (string, error)

GetPodLogsContextE returns the logs of a Pod at the time when the function was called. The ctx parameter supports cancellation and timeouts. Pass container name if there are more containers in the Pod or set to "" if there is only one. If the Pod is not running an Error is returned. If the provided containerName is not the name of a container in the Pod an Error is returned.

func GetPodLogsE deprecated added in v0.41.10

func GetPodLogsE(t testing.TestingT, options *KubectlOptions, pod *corev1.Pod, containerName string) (string, error)

GetPodLogsE returns the logs of a Pod at the time when the function was called. Pass container name if there are more containers in the Pod or set to "" if there is only one. If the Pod is not running an Error is returned. If the provided containerName is not the name of a container in the Pod an Error is returned.

Deprecated: Use GetPodLogsContextE instead.

func GetReadyNodes deprecated

func GetReadyNodes(t testing.TestingT, options *KubectlOptions) []corev1.Node

GetReadyNodes queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state. If anything goes wrong, the function will automatically fail the test.

Deprecated: Use GetReadyNodesContext instead.

func GetReadyNodesContext added in v1.0.0

func GetReadyNodesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions) []corev1.Node

GetReadyNodesContext queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetReadyNodesContextE added in v1.0.0

func GetReadyNodesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions) ([]corev1.Node, error)

GetReadyNodesContextE queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state. The ctx parameter supports cancellation and timeouts.

func GetReadyNodesE deprecated

func GetReadyNodesE(t testing.TestingT, options *KubectlOptions) ([]corev1.Node, error)

GetReadyNodesE queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state.

Deprecated: Use GetReadyNodesContextE instead.

func GetReplicaSet deprecated added in v0.32.12

func GetReplicaSet(t testing.TestingT, options *KubectlOptions, replicaSetName string) *appsv1.ReplicaSet

GetReplicaSet returns a Kubernetes replicaset resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetReplicaSetContext instead.

func GetReplicaSetContext added in v1.0.0

func GetReplicaSetContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, replicaSetName string) *appsv1.ReplicaSet

GetReplicaSetContext returns a Kubernetes replicaset resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetReplicaSetContextE added in v1.0.0

func GetReplicaSetContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, replicaSetName string) (*appsv1.ReplicaSet, error)

GetReplicaSetContextE returns a Kubernetes replicaset resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetReplicaSetE deprecated added in v0.32.12

func GetReplicaSetE(t testing.TestingT, options *KubectlOptions, replicaSetName string) (*appsv1.ReplicaSet, error)

GetReplicaSetE returns a Kubernetes replicaset resource in the provided namespace with the given name.

Deprecated: Use GetReplicaSetContextE instead.

func GetRole deprecated added in v0.13.30

func GetRole(t testing.TestingT, options *KubectlOptions, roleName string) *rbacv1.Role

GetRole returns a Kubernetes role resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use GetRoleContext instead.

func GetRoleContext added in v1.0.0

func GetRoleContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, roleName string) *rbacv1.Role

GetRoleContext returns a Kubernetes role resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetRoleContextE added in v1.0.0

func GetRoleContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, roleName string) (*rbacv1.Role, error)

GetRoleContextE returns a Kubernetes role resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func GetRoleE deprecated added in v0.13.30

func GetRoleE(t testing.TestingT, options *KubectlOptions, roleName string) (*rbacv1.Role, error)

GetRoleE returns a Kubernetes role resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use GetRoleContextE instead.

func GetSecret deprecated added in v0.13.22

func GetSecret(t testing.TestingT, options *KubectlOptions, secretName string) *corev1.Secret

GetSecret returns a Kubernetes secret resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use GetSecretContext instead.

func GetSecretContext added in v1.0.0

func GetSecretContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, secretName string) *corev1.Secret

GetSecretContext returns a Kubernetes secret resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetSecretContextE added in v1.0.0

func GetSecretContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, secretName string) (*corev1.Secret, error)

GetSecretContextE returns a Kubernetes secret resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func GetSecretE deprecated added in v0.13.22

func GetSecretE(t testing.TestingT, options *KubectlOptions, secretName string) (*corev1.Secret, error)

GetSecretE returns a Kubernetes secret resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use GetSecretContextE instead.

func GetService deprecated added in v0.13.16

func GetService(t testing.TestingT, options *KubectlOptions, serviceName string) *corev1.Service

GetService returns a Kubernetes service resource in the provided namespace with the given name. This will fail the test if there is an error.

Deprecated: Use GetServiceContext instead.

func GetServiceAccount deprecated added in v0.13.22

func GetServiceAccount(t testing.TestingT, options *KubectlOptions, serviceAccountName string) *corev1.ServiceAccount

GetServiceAccount returns a Kubernetes service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. This will fail the test if there is an error.

Deprecated: Use GetServiceAccountContext instead.

func GetServiceAccountAuthToken deprecated added in v0.13.24

func GetServiceAccountAuthToken(t testing.TestingT, kubectlOptions *KubectlOptions, serviceAccountName string) string

GetServiceAccountAuthToken will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount. This will fail the test if there is an error.

Deprecated: Use GetServiceAccountAuthTokenContext instead.

func GetServiceAccountAuthTokenContext added in v1.0.0

func GetServiceAccountAuthTokenContext(t testing.TestingT, ctx context.Context, kubectlOptions *KubectlOptions, serviceAccountName string) string

GetServiceAccountAuthTokenContext will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetServiceAccountAuthTokenContextE added in v1.0.0

func GetServiceAccountAuthTokenContextE(t testing.TestingT, ctx context.Context, kubectlOptions *KubectlOptions, serviceAccountName string) (string, error)

GetServiceAccountAuthTokenContextE will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount. On K8s 1.24+, service account tokens are no longer auto-created as secrets, so this uses the TokenRequest API. The ctx parameter supports cancellation and timeouts.

func GetServiceAccountAuthTokenE deprecated added in v0.13.24

func GetServiceAccountAuthTokenE(t testing.TestingT, kubectlOptions *KubectlOptions, serviceAccountName string) (string, error)

GetServiceAccountAuthTokenE will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount. On K8s 1.24+, service account tokens are no longer auto-created as secrets, so this uses the TokenRequest API.

Deprecated: Use GetServiceAccountAuthTokenContextE instead.

func GetServiceAccountContext added in v1.0.0

func GetServiceAccountContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceAccountName string) *corev1.ServiceAccount

GetServiceAccountContext returns a Kubernetes service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetServiceAccountContextE added in v1.0.0

func GetServiceAccountContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceAccountName string) (*corev1.ServiceAccount, error)

GetServiceAccountContextE returns a Kubernetes service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions. The ctx parameter supports cancellation and timeouts.

func GetServiceAccountE deprecated added in v0.13.22

func GetServiceAccountE(t testing.TestingT, options *KubectlOptions, serviceAccountName string) (*corev1.ServiceAccount, error)

GetServiceAccountE returns a Kubernetes service account resource in the provided namespace with the given name. The namespace used is the one provided in the KubectlOptions.

Deprecated: Use GetServiceAccountContextE instead.

func GetServiceContext added in v1.0.0

func GetServiceContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceName string) *corev1.Service

GetServiceContext returns a Kubernetes service resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func GetServiceContextE added in v1.0.0

func GetServiceContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceName string) (*corev1.Service, error)

GetServiceContextE returns a Kubernetes service resource in the provided namespace with the given name. The ctx parameter supports cancellation and timeouts.

func GetServiceE deprecated added in v0.13.16

func GetServiceE(t testing.TestingT, options *KubectlOptions, serviceName string) (*corev1.Service, error)

GetServiceE returns a Kubernetes service resource in the provided namespace with the given name.

Deprecated: Use GetServiceContextE instead.

func GetServiceEndpoint deprecated added in v0.13.16

func GetServiceEndpoint(t testing.TestingT, options *KubectlOptions, service *corev1.Service, servicePort int) string

GetServiceEndpoint will return the service access point. If the service endpoint is not ready, will fail the test immediately.

Deprecated: Use GetServiceEndpointContext instead.

func GetServiceEndpointContext added in v1.0.0

func GetServiceEndpointContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, service *corev1.Service, servicePort int) string

GetServiceEndpointContext will return the service access point using the provided context. If the service endpoint is not ready, will fail the test immediately.

func GetServiceEndpointContextE added in v1.0.0

func GetServiceEndpointContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, service *corev1.Service, servicePort int) (string, error)

GetServiceEndpointContextE will return the service access point using the provided context and the following logic:

  • For ClusterIP service type, return the URL that maps to ClusterIP and Service Port
  • For NodePort service type, identify the public IP of the node (if it exists, otherwise return the bound hostname), and the assigned node port for the provided service port, and return the URL that maps to node ip and node port.
  • For LoadBalancer service type, return the publicly accessible hostname of the load balancer. If the hostname is empty, it will return the public IP of the LoadBalancer.
  • All other service types are not supported.

func GetServiceEndpointE deprecated added in v0.13.16

func GetServiceEndpointE(t testing.TestingT, options *KubectlOptions, service *corev1.Service, servicePort int) (string, error)

GetServiceEndpointE will return the service access point using the following logic:

  • For ClusterIP service type, return the URL that maps to ClusterIP and Service Port
  • For NodePort service type, identify the public IP of the node (if it exists, otherwise return the bound hostname), and the assigned node port for the provided service port, and return the URL that maps to node ip and node port.
  • For LoadBalancer service type, return the publicly accessible hostname of the load balancer. If the hostname is empty, it will return the public IP of the LoadBalancer.
  • All other service types are not supported.

Deprecated: Use GetServiceEndpointContextE instead.

func IsCronJobSucceeded added in v0.50.0

func IsCronJobSucceeded(cronJob *batchv1.CronJob) bool

IsCronJobSucceeded returns true if cron job successfully scheduled and completed job. https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/cron-job-v1/#CronJobStatus

func IsDaemonSetAvailable added in v1.0.0

func IsDaemonSetAvailable(ds *appsv1.DaemonSet) bool

IsDaemonSetAvailable returns true once the daemonset's rollout is complete. The check mirrors `kubectl rollout status ds`: the controller has observed the latest spec, every scheduled pod has been updated to the current generation, and every desired pod is available. Status fields are used directly rather than DaemonSetCondition because the controller does not always populate that field.

A daemonset whose node selector matches zero nodes (DesiredNumberScheduled == 0) is treated as available — this matches the kubectl behavior where such a daemonset is considered "successfully rolled out".

func IsDeploymentAvailable added in v0.41.21

func IsDeploymentAvailable(deploy *appsv1.Deployment) bool

IsDeploymentAvailable returns true if all pods within the deployment are ready and started

func IsIngressAvailable added in v0.14.5

func IsIngressAvailable(ingress *networkingv1.Ingress) bool

IsIngressAvailable returns true if the Ingress endpoint is provisioned and available.

func IsIngressAvailableV1Beta1 added in v0.34.0

func IsIngressAvailableV1Beta1(ingress *networkingv1beta1.Ingress) bool

IsIngressAvailableV1Beta1 returns true if the Ingress endpoint is provisioned and available, using networking.k8s.io/v1beta1 API.

func IsJobSucceeded added in v0.36.7

func IsJobSucceeded(job *batchv1.Job) bool

IsJobSucceeded returns true when the job status condition "Complete" is true. This behavior is documented in the kubernetes API reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/job-v1/#JobStatus

func IsMinikubeE added in v0.23.5

func IsMinikubeE(t testing.TestingT, options *KubectlOptions) (bool, error)

IsMinikubeE returns true if the underlying kubernetes cluster is Minikube. This is determined by getting the associated nodes and checking if all nodes has at least one label namespaced with "minikube.k8s.io".

func IsNodeReady

func IsNodeReady(node corev1.Node) bool

IsNodeReady takes a Kubernetes Node information object and checks if the Node is in the ready state.

func IsPersistentVolumeClaimInStatus added in v0.41.25

func IsPersistentVolumeClaimInStatus(pvc *corev1.PersistentVolumeClaim, pvcStatusPhase *corev1.PersistentVolumeClaimPhase) bool

IsPersistentVolumeClaimInStatus returns true if the given PersistentVolumeClaim is in the given status phase

func IsPersistentVolumeInStatus added in v0.41.24

func IsPersistentVolumeInStatus(pv *corev1.PersistentVolume, pvStatusPhase *corev1.PersistentVolumePhase) bool

IsPersistentVolumeInStatus returns true if the given PersistentVolume is in the given status phase

func IsPodAvailable added in v0.13.21

func IsPodAvailable(pod *corev1.Pod) bool

IsPodAvailable returns true if the all of the containers within the pod are ready and started

func IsServiceAvailable added in v0.13.16

func IsServiceAvailable(service *corev1.Service) bool

IsServiceAvailable returns true if the service endpoint is ready to accept traffic. Note that for Minikube, this function is moot as all services, even LoadBalancer, is available immediately.

func KubeConfigPathFromHomeDirE added in v0.13.14

func KubeConfigPathFromHomeDirE() (string, error)

KubeConfigPathFromHomeDirE returns a string to the default Kubernetes config path in the home directory. This will error if the home directory can not be determined.

func KubectlApply deprecated added in v0.13.16

func KubectlApply(t testing.TestingT, options *KubectlOptions, configPath string)

KubectlApply will take in a file path and apply it to the cluster targeted by KubectlOptions. If there are any errors, fail the test immediately.

Deprecated: Use KubectlApplyContext instead.

func KubectlApplyContext added in v1.0.0

func KubectlApplyContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string)

KubectlApplyContext applies the resource at configPath to the cluster, using the provided context. Fails the test on error.

func KubectlApplyContextE added in v1.0.0

func KubectlApplyContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string) error

KubectlApplyContextE applies the resource at configPath to the cluster, using the provided context.

func KubectlApplyE deprecated added in v0.13.16

func KubectlApplyE(t testing.TestingT, options *KubectlOptions, configPath string) error

KubectlApplyE will take in a file path and apply it to the cluster targeted by KubectlOptions.

Deprecated: Use KubectlApplyContextE instead.

func KubectlApplyFromKustomize deprecated added in v0.40.22

func KubectlApplyFromKustomize(t testing.TestingT, options *KubectlOptions, configPath string)

KubectlApplyFromKustomize will take in a kustomization directory path and apply it to the cluster targeted by KubectlOptions. If there are any errors, fail the test immediately.

Deprecated: Use KubectlApplyFromKustomizeContext instead.

func KubectlApplyFromKustomizeContext added in v1.0.0

func KubectlApplyFromKustomizeContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string)

KubectlApplyFromKustomizeContext applies the kustomization at configPath to the cluster, using the provided context. Fails the test on error.

func KubectlApplyFromKustomizeContextE added in v1.0.0

func KubectlApplyFromKustomizeContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string) error

KubectlApplyFromKustomizeContextE applies the kustomization at configPath to the cluster, using the provided context.

func KubectlApplyFromKustomizeE deprecated added in v0.40.22

func KubectlApplyFromKustomizeE(t testing.TestingT, options *KubectlOptions, configPath string) error

KubectlApplyFromKustomizeE will take in a kustomization directory path and apply it to the cluster targeted by KubectlOptions.

Deprecated: Use KubectlApplyFromKustomizeContextE instead.

func KubectlApplyFromString deprecated added in v0.13.16

func KubectlApplyFromString(t testing.TestingT, options *KubectlOptions, configData string)

KubectlApplyFromString will take in a kubernetes resource config as a string and apply it on the cluster specified by the provided kubectl options.

Deprecated: Use KubectlApplyFromStringContext instead.

func KubectlApplyFromStringContext added in v1.0.0

func KubectlApplyFromStringContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configData string)

KubectlApplyFromStringContext applies the kubernetes resource from configData to the cluster, using the provided context. Fails the test on error.

func KubectlApplyFromStringContextE added in v1.0.0

func KubectlApplyFromStringContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configData string) error

KubectlApplyFromStringContextE applies the kubernetes resource from configData to the cluster, using the provided context.

func KubectlApplyFromStringE deprecated added in v0.13.16

func KubectlApplyFromStringE(t testing.TestingT, options *KubectlOptions, configData string) error

KubectlApplyFromStringE will take in a kubernetes resource config as a string and apply it on the cluster specified by the provided kubectl options. If it fails, this will return the error.

Deprecated: Use KubectlApplyFromStringContextE instead.

func KubectlDelete deprecated added in v0.13.16

func KubectlDelete(t testing.TestingT, options *KubectlOptions, configPath string)

KubectlDelete will take in a file path and delete it from the cluster targeted by KubectlOptions. If there are any errors, fail the test immediately.

Deprecated: Use KubectlDeleteContext instead.

func KubectlDeleteContext added in v1.0.0

func KubectlDeleteContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string)

KubectlDeleteContext deletes the resource at configPath from the cluster, using the provided context. Fails the test on error.

func KubectlDeleteContextE added in v1.0.0

func KubectlDeleteContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string) error

KubectlDeleteContextE deletes the resource at configPath from the cluster, using the provided context.

func KubectlDeleteE deprecated added in v0.13.16

func KubectlDeleteE(t testing.TestingT, options *KubectlOptions, configPath string) error

KubectlDeleteE will take in a file path and delete it from the cluster targeted by KubectlOptions.

Deprecated: Use KubectlDeleteContextE instead.

func KubectlDeleteFromKustomize deprecated added in v0.40.22

func KubectlDeleteFromKustomize(t testing.TestingT, options *KubectlOptions, configPath string)

KubectlDeleteFromKustomize will take in a kustomization directory path and delete it from the cluster targeted by KubectlOptions. If there are any errors, fail the test immediately.

Deprecated: Use KubectlDeleteFromKustomizeContext instead.

func KubectlDeleteFromKustomizeContext added in v1.0.0

func KubectlDeleteFromKustomizeContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string)

KubectlDeleteFromKustomizeContext deletes the kustomization at configPath from the cluster, using the provided context. Fails the test on error.

func KubectlDeleteFromKustomizeContextE added in v1.0.0

func KubectlDeleteFromKustomizeContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configPath string) error

KubectlDeleteFromKustomizeContextE deletes the kustomization at configPath from the cluster, using the provided context.

func KubectlDeleteFromKustomizeE deprecated added in v0.40.22

func KubectlDeleteFromKustomizeE(t testing.TestingT, options *KubectlOptions, configPath string) error

KubectlDeleteFromKustomizeE will take in a kustomization directory path and delete it from the cluster targeted by KubectlOptions.

Deprecated: Use KubectlDeleteFromKustomizeContextE instead.

func KubectlDeleteFromString deprecated added in v0.13.16

func KubectlDeleteFromString(t testing.TestingT, options *KubectlOptions, configData string)

KubectlDeleteFromString will take in a kubernetes resource config as a string and delete it on the cluster specified by the provided kubectl options.

Deprecated: Use KubectlDeleteFromStringContext instead.

func KubectlDeleteFromStringContext added in v1.0.0

func KubectlDeleteFromStringContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configData string)

KubectlDeleteFromStringContext deletes the kubernetes resource from configData on the cluster, using the provided context. Fails the test on error.

func KubectlDeleteFromStringContextE added in v1.0.0

func KubectlDeleteFromStringContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configData string) error

KubectlDeleteFromStringContextE deletes the kubernetes resource from configData on the cluster, using the provided context.

func KubectlDeleteFromStringE deprecated added in v0.13.16

func KubectlDeleteFromStringE(t testing.TestingT, options *KubectlOptions, configData string) error

KubectlDeleteFromStringE will take in a kubernetes resource config as a string and delete it on the cluster specified by the provided kubectl options. If it fails, this will return the error.

Deprecated: Use KubectlDeleteFromStringContextE instead.

func ListCronJobs deprecated added in v0.50.0

func ListCronJobs(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []batchv1.CronJob

ListCronJobs list cron jobs in namespace that match provided filters. This will fail the test if there is an error.

Deprecated: Use ListCronJobsContext instead.

func ListCronJobsContext added in v1.0.0

func ListCronJobsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []batchv1.CronJob

ListCronJobsContext lists cron jobs in namespace that match provided filters and returns them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListCronJobsContextE added in v1.0.0

func ListCronJobsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]batchv1.CronJob, error)

ListCronJobsContextE lists cron jobs in namespace that match provided filters and returns them. The ctx parameter supports cancellation and timeouts.

func ListCronJobsE deprecated added in v0.50.0

func ListCronJobsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]batchv1.CronJob, error)

ListCronJobsE list cron jobs in namespace that match provided filters. This will return list or error.

Deprecated: Use ListCronJobsContextE instead.

func ListDaemonSets deprecated added in v0.19.6

func ListDaemonSets(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []appsv1.DaemonSet

ListDaemonSets will look for daemonsets in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListDaemonSetsContext instead.

func ListDaemonSetsContext added in v1.0.0

func ListDaemonSetsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []appsv1.DaemonSet

ListDaemonSetsContext looks up daemonsets in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListDaemonSetsContextE added in v1.0.0

func ListDaemonSetsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.DaemonSet, error)

ListDaemonSetsContextE looks up daemonsets in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListDaemonSetsE deprecated added in v0.19.6

func ListDaemonSetsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.DaemonSet, error)

ListDaemonSetsE will look for daemonsets in the given namespace that match the given filters and return them.

Deprecated: Use ListDaemonSetsContextE instead.

func ListDeployments deprecated added in v0.41.21

func ListDeployments(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []appsv1.Deployment

ListDeployments will look for deployments in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListDeploymentsContext instead.

func ListDeploymentsContext added in v1.0.0

func ListDeploymentsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []appsv1.Deployment

ListDeploymentsContext looks up deployments in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListDeploymentsContextE added in v1.0.0

func ListDeploymentsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.Deployment, error)

ListDeploymentsContextE looks up deployments in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListDeploymentsE deprecated added in v0.41.21

func ListDeploymentsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.Deployment, error)

ListDeploymentsE will look for deployments in the given namespace that match the given filters and return them.

Deprecated: Use ListDeploymentsContextE instead.

func ListEvents deprecated added in v0.43.6

func ListEvents(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.Event

ListEvents will retrieve the Events in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListEventsContext instead.

func ListEventsContext added in v1.0.0

func ListEventsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.Event

ListEventsContext retrieves the Events in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListEventsContextE added in v1.0.0

func ListEventsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Event, error)

ListEventsContextE retrieves the Events in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListEventsE deprecated added in v0.43.6

func ListEventsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Event, error)

ListEventsE will retrieve the Events that match the given filters and return them.

Deprecated: Use ListEventsContextE instead.

func ListIngresses deprecated added in v0.14.5

func ListIngresses(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []networkingv1.Ingress

ListIngresses will look for Ingress resources in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListIngressesContext instead.

func ListIngressesContext added in v1.0.0

func ListIngressesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []networkingv1.Ingress

ListIngressesContext will look for Ingress resources in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListIngressesContextE added in v1.0.0

func ListIngressesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]networkingv1.Ingress, error)

ListIngressesContextE will look for Ingress resources in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListIngressesE deprecated added in v0.14.5

func ListIngressesE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]networkingv1.Ingress, error)

ListIngressesE will look for Ingress resources in the given namespace that match the given filters and return them.

Deprecated: Use ListIngressesContextE instead.

func ListIngressesV1Beta1 deprecated added in v0.34.0

func ListIngressesV1Beta1(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []networkingv1beta1.Ingress

ListIngressesV1Beta1 will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API. This will fail the test if there is an error.

Deprecated: Use ListIngressesV1Beta1Context instead.

func ListIngressesV1Beta1Context added in v1.0.0

func ListIngressesV1Beta1Context(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []networkingv1beta1.Ingress

ListIngressesV1Beta1Context will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListIngressesV1Beta1ContextE added in v1.0.0

func ListIngressesV1Beta1ContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]networkingv1beta1.Ingress, error)

ListIngressesV1Beta1ContextE will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts.

func ListIngressesV1Beta1E deprecated added in v0.34.0

func ListIngressesV1Beta1E(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]networkingv1beta1.Ingress, error)

ListIngressesV1Beta1E will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API.

Deprecated: Use ListIngressesV1Beta1ContextE instead.

func ListJobs deprecated added in v0.36.7

func ListJobs(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []batchv1.Job

ListJobs will look for Jobs in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListJobsContext instead.

func ListJobsContext added in v1.0.0

func ListJobsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []batchv1.Job

ListJobsContext looks up Jobs in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListJobsContextE added in v1.0.0

func ListJobsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]batchv1.Job, error)

ListJobsContextE looks up Jobs in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListJobsE deprecated added in v0.36.7

func ListJobsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]batchv1.Job, error)

ListJobsE will look for jobs in the given namespace that match the given filters and return them.

Deprecated: Use ListJobsContextE instead.

func ListNamespaces deprecated added in v0.49.0

func ListNamespaces(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.Namespace

ListNamespaces will list all namespaces in the Kubernetes cluster targeted by the provided options. This will fail the test if there is an error in listing the namespaces.

Deprecated: Use ListNamespacesContext instead.

func ListNamespacesContext added in v1.0.0

func ListNamespacesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.Namespace

ListNamespacesContext lists all namespaces in the Kubernetes cluster that match the given filters and returns them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListNamespacesContextE added in v1.0.0

func ListNamespacesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Namespace, error)

ListNamespacesContextE lists all namespaces in the Kubernetes cluster that match the given filters and returns them. The ctx parameter supports cancellation and timeouts.

func ListNamespacesE deprecated added in v0.49.0

func ListNamespacesE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Namespace, error)

ListNamespacesE lists all namespaces in the Kubernetes cluster and returns them or an error.

Deprecated: Use ListNamespacesContextE instead.

func ListPersistentVolumeClaims deprecated added in v0.41.25

func ListPersistentVolumeClaims(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.PersistentVolumeClaim

ListPersistentVolumeClaims will look for PersistentVolumeClaims in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListPersistentVolumeClaimsContext instead.

func ListPersistentVolumeClaimsContext added in v1.0.0

func ListPersistentVolumeClaimsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.PersistentVolumeClaim

ListPersistentVolumeClaimsContext will look for PersistentVolumeClaims in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListPersistentVolumeClaimsContextE added in v1.0.0

func ListPersistentVolumeClaimsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.PersistentVolumeClaim, error)

ListPersistentVolumeClaimsContextE will look for PersistentVolumeClaims in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListPersistentVolumeClaimsE deprecated added in v0.41.25

func ListPersistentVolumeClaimsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.PersistentVolumeClaim, error)

ListPersistentVolumeClaimsE will look for PersistentVolumeClaims in the given namespace that match the given filters and return them.

Deprecated: Use ListPersistentVolumeClaimsContextE instead.

func ListPersistentVolumes deprecated added in v0.41.24

func ListPersistentVolumes(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.PersistentVolume

ListPersistentVolumes will look for PersistentVolumes in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListPersistentVolumesContext instead.

func ListPersistentVolumesContext added in v1.0.0

func ListPersistentVolumesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.PersistentVolume

ListPersistentVolumesContext will look for PersistentVolumes that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListPersistentVolumesContextE added in v1.0.0

func ListPersistentVolumesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.PersistentVolume, error)

ListPersistentVolumesContextE will look for PersistentVolumes that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListPersistentVolumesE deprecated added in v0.41.24

func ListPersistentVolumesE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.PersistentVolume, error)

ListPersistentVolumesE will look for PersistentVolumes that match the given filters and return them.

Deprecated: Use ListPersistentVolumesContextE instead.

func ListPods deprecated added in v0.13.28

func ListPods(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.Pod

ListPods will look for pods in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListPodsContext instead.

func ListPodsContext added in v1.0.0

func ListPodsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.Pod

ListPodsContext looks up pods in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListPodsContextE added in v1.0.0

func ListPodsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Pod, error)

ListPodsContextE looks up pods in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListPodsE deprecated added in v0.13.28

func ListPodsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Pod, error)

ListPodsE will look for pods in the given namespace that match the given filters and return them.

Deprecated: Use ListPodsContextE instead.

func ListReplicaSets deprecated added in v0.32.12

func ListReplicaSets(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []appsv1.ReplicaSet

ListReplicaSets will look for replicasets in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListReplicaSetsContext instead.

func ListReplicaSetsContext added in v1.0.0

func ListReplicaSetsContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []appsv1.ReplicaSet

ListReplicaSetsContext looks up replicasets in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListReplicaSetsContextE added in v1.0.0

func ListReplicaSetsContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.ReplicaSet, error)

ListReplicaSetsContextE looks up replicasets in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListReplicaSetsE deprecated added in v0.32.12

func ListReplicaSetsE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]appsv1.ReplicaSet, error)

ListReplicaSetsE will look for replicasets in the given namespace that match the given filters and return them.

Deprecated: Use ListReplicaSetsContextE instead.

func ListServices deprecated added in v0.13.28

func ListServices(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) []corev1.Service

ListServices will look for services in the given namespace that match the given filters and return them. This will fail the test if there is an error.

Deprecated: Use ListServicesContext instead.

func ListServicesContext added in v1.0.0

func ListServicesContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) []corev1.Service

ListServicesContext looks up services in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func ListServicesContextE added in v1.0.0

func ListServicesContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Service, error)

ListServicesContextE looks up services in the given namespace that match the given filters and return them. The ctx parameter supports cancellation and timeouts.

func ListServicesE deprecated added in v0.13.28

func ListServicesE(t testing.TestingT, options *KubectlOptions, filters metav1.ListOptions) ([]corev1.Service, error)

ListServicesE will look for services in the given namespace that match the given filters and return them.

Deprecated: Use ListServicesContextE instead.

func LoadAPIClientConfigE added in v1.0.0

func LoadAPIClientConfigE(configPath string, contextName string) (*restclient.Config, error)

LoadAPIClientConfigE loads a ClientConfig object from a file path that points to a location on disk containing a kubectl config, with the requested context loaded.

func LoadApiClientConfigE deprecated added in v0.13.16

func LoadApiClientConfigE(configPath string, contextName string) (*restclient.Config, error)

LoadApiClientConfigE loads a ClientConfig object from a file path that points to a location on disk containing a kubectl config, with the requested context loaded.

Deprecated: Use LoadAPIClientConfigE instead.

func LoadConfigFromPath

func LoadConfigFromPath(path string) clientcmd.ClientConfig

LoadConfigFromPath will load a ClientConfig object from a file path that points to a location on disk containing a kubectl config.

func RemoveOrphanedClusterAndAuthInfoConfig

func RemoveOrphanedClusterAndAuthInfoConfig(config *api.Config)

RemoveOrphanedClusterAndAuthInfoConfig will remove all configurations related to clusters and users that have no contexts associated with it

func RunKubectl deprecated added in v0.13.16

func RunKubectl(t testing.TestingT, options *KubectlOptions, args ...string)

RunKubectl calls kubectl using the provided options and args, failing the test on error.

Deprecated: Use RunKubectlContext instead.

func RunKubectlAndGetOutputContextE added in v1.0.0

func RunKubectlAndGetOutputContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, args ...string) (string, error)

RunKubectlAndGetOutputContextE calls kubectl using the provided context, options, and args, returning the combined output of stdout and stderr.

func RunKubectlAndGetOutputE deprecated added in v0.13.16

func RunKubectlAndGetOutputE(t testing.TestingT, options *KubectlOptions, args ...string) (string, error)

RunKubectlAndGetOutputE calls kubectl using the provided options and args, returning the combined output of stdout and stderr.

Deprecated: Use RunKubectlAndGetOutputContextE instead.

func RunKubectlContext added in v1.0.0

func RunKubectlContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, args ...string)

RunKubectlContext calls kubectl using the provided context, options, and args, failing the test on error.

func RunKubectlContextE added in v1.0.0

func RunKubectlContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, args ...string) error

RunKubectlContextE calls kubectl using the provided context, options, and args.

func RunKubectlE deprecated added in v0.13.16

func RunKubectlE(t testing.TestingT, options *KubectlOptions, args ...string) error

RunKubectlE calls kubectl using the provided options and args.

Deprecated: Use RunKubectlContextE instead.

func StoreConfigToTempFile added in v0.13.16

func StoreConfigToTempFile(t testing.TestingT, configData string) string

StoreConfigToTempFile will store the provided config data to a temporary file created on the os and return the filename.

func StoreConfigToTempFileE added in v0.13.16

func StoreConfigToTempFileE(t testing.TestingT, configData string) (string, error)

StoreConfigToTempFileE will store the provided config data to a temporary file created on the os and return the filename, or error.

func UnmarshalJSONPath added in v0.30.16

func UnmarshalJSONPath(t testing.TestingT, jsonData []byte, jsonpathStr string, output any)

UnmarshalJSONPath allows you to use an arbitrary JSONPath string to query a json blob and unmarshal the resulting output into a go object. Note that the output will always be a list. That means that if you query a single object, the output will be a list of single element, not the element itself. However, if the json path maps to a list, then the output will be that list. Example:

jsonBlob := []byte(`{"key": {"data": [1,2,3]}}`) jsonPath := "{.key.data[*]}" var output []int UnmarshalJSONPath(t, jsonBlob, jsonPath, &output) // output is []int{1,2,3}

This will fail the test if there is an error.

func UnmarshalJSONPathE added in v0.30.16

func UnmarshalJSONPathE(t testing.TestingT, jsonData []byte, jsonpathStr string, output any) error

UnmarshalJSONPathE allows you to use an arbitrary JSONPath string to query a json blob and unmarshal the resulting output into a go object. Note that the output will always be a list. That means that if you query a single object, the output will be a list of single element, not the element itself. However, if the json path maps to a list, then the output will be that list. Example:

jsonBlob := []byte(`{"key": {"data": [1,2,3]}}`) jsonPath := "{.key.data[*]}" var output []int UnmarshalJSONPathE(t, jsonBlob, jsonPath, &output) => output = []int{1,2,3}

func UpsertConfigContext added in v0.13.24

func UpsertConfigContext(config *api.Config, contextName string, clusterName string, userName string)

UpsertConfigContext will update or insert a new context to the provided config, binding the provided cluster to the provided user.

func WaitUntilAllNodesReady deprecated

func WaitUntilAllNodesReady(t testing.TestingT, options *KubectlOptions, retries int, sleepBetweenRetries time.Duration)

WaitUntilAllNodesReady continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries. Will fail the test immediately if it times out.

Deprecated: Use WaitUntilAllNodesReadyContext instead.

func WaitUntilAllNodesReadyContext added in v1.0.0

func WaitUntilAllNodesReadyContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, retries int, sleepBetweenRetries time.Duration)

WaitUntilAllNodesReadyContext continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilAllNodesReadyContextE added in v1.0.0

func WaitUntilAllNodesReadyContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, retries int, sleepBetweenRetries time.Duration) error

WaitUntilAllNodesReadyContextE continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries. The ctx parameter supports cancellation and timeouts.

func WaitUntilAllNodesReadyE deprecated

func WaitUntilAllNodesReadyE(t testing.TestingT, options *KubectlOptions, retries int, sleepBetweenRetries time.Duration) error

WaitUntilAllNodesReadyE continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries.

Deprecated: Use WaitUntilAllNodesReadyContextE instead.

func WaitUntilConfigMapAvailable deprecated added in v0.41.6

func WaitUntilConfigMapAvailable(t testing.TestingT, options *KubectlOptions, configMapName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilConfigMapAvailable waits until the configmap is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate).

Deprecated: Use WaitUntilConfigMapAvailableContext instead.

func WaitUntilConfigMapAvailableContext added in v1.0.0

func WaitUntilConfigMapAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, configMapName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilConfigMapAvailableContext waits until the configmap is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilConfigMapAvailableContextE added in v1.0.0

func WaitUntilConfigMapAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, configMapName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilConfigMapAvailableContextE waits until the configmap is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts.

func WaitUntilCronJobSucceed deprecated added in v0.50.0

func WaitUntilCronJobSucceed(t testing.TestingT, options *KubectlOptions, cronJobName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilCronJobSucceed waits until cron job will successfully complete a job. This will fail the test if there is an error or if the check times out.

Deprecated: Use WaitUntilCronJobSucceedContext instead.

func WaitUntilCronJobSucceedContext added in v1.0.0

func WaitUntilCronJobSucceedContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilCronJobSucceedContext waits until cron job will successfully complete a job, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilCronJobSucceedContextE added in v1.0.0

func WaitUntilCronJobSucceedContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, cronJobName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilCronJobSucceedContextE waits until cron job will successfully complete a job, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilCronJobSucceedE deprecated added in v0.50.0

func WaitUntilCronJobSucceedE(t testing.TestingT, options *KubectlOptions, cronJobName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilCronJobSucceedE waits until cron job will successfully complete a job, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilCronJobSucceedContextE instead.

func WaitUntilDaemonSetAvailable deprecated added in v1.0.0

func WaitUntilDaemonSetAvailable(t testing.TestingT, options *KubectlOptions, daemonSetName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilDaemonSetAvailable waits until all desired pods of the daemonset are available on their nodes, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error.

Deprecated: Use WaitUntilDaemonSetAvailableContext instead.

func WaitUntilDaemonSetAvailableContext added in v1.0.0

func WaitUntilDaemonSetAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, daemonSetName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilDaemonSetAvailableContext waits until all desired pods of the daemonset are available on their nodes, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilDaemonSetAvailableContextE added in v1.0.0

func WaitUntilDaemonSetAvailableContextE(
	t testing.TestingT,
	ctx context.Context,
	options *KubectlOptions,
	daemonSetName string,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilDaemonSetAvailableContextE waits until all desired pods of the daemonset are available on their nodes, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilDaemonSetAvailableE deprecated added in v1.0.0

func WaitUntilDaemonSetAvailableE(
	t testing.TestingT,
	options *KubectlOptions,
	daemonSetName string,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilDaemonSetAvailableE waits until all desired pods of the daemonset are available on their nodes, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilDaemonSetAvailableContextE instead.

func WaitUntilDeploymentAvailable deprecated added in v0.41.21

func WaitUntilDeploymentAvailable(t testing.TestingT, options *KubectlOptions, deploymentName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilDeploymentAvailable waits until all pods within the deployment are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error.

Deprecated: Use WaitUntilDeploymentAvailableContext instead.

func WaitUntilDeploymentAvailableContext added in v1.0.0

func WaitUntilDeploymentAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, deploymentName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilDeploymentAvailableContext waits until all pods within the deployment are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilDeploymentAvailableContextE added in v1.0.0

func WaitUntilDeploymentAvailableContextE(
	t testing.TestingT,
	ctx context.Context,
	options *KubectlOptions,
	deploymentName string,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilDeploymentAvailableContextE waits until all pods within the deployment are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilDeploymentAvailableE deprecated added in v0.41.21

func WaitUntilDeploymentAvailableE(
	t testing.TestingT,
	options *KubectlOptions,
	deploymentName string,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilDeploymentAvailableE waits until all pods within the deployment are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilDeploymentAvailableContextE instead.

func WaitUntilIngressAvailable deprecated added in v0.14.5

func WaitUntilIngressAvailable(t testing.TestingT, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilIngressAvailable waits until the Ingress resource has an endpoint provisioned for it.

Deprecated: Use WaitUntilIngressAvailableContext instead.

func WaitUntilIngressAvailableContext added in v1.0.0

func WaitUntilIngressAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilIngressAvailableContext waits until the Ingress resource has an endpoint provisioned for it. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilIngressAvailableContextE added in v1.0.0

func WaitUntilIngressAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilIngressAvailableContextE waits until the Ingress resource has an endpoint provisioned for it. The ctx parameter supports cancellation and timeouts.

func WaitUntilIngressAvailableV1Beta1 deprecated added in v0.34.0

func WaitUntilIngressAvailableV1Beta1(t testing.TestingT, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilIngressAvailableV1Beta1 waits until the Ingress resource has an endpoint provisioned for it, using networking.k8s.io/v1beta1 API.

Deprecated: Use WaitUntilIngressAvailableV1Beta1Context instead.

func WaitUntilIngressAvailableV1Beta1Context added in v1.0.0

func WaitUntilIngressAvailableV1Beta1Context(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilIngressAvailableV1Beta1Context waits until the Ingress resource has an endpoint provisioned for it, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilIngressAvailableV1Beta1ContextE added in v1.0.0

func WaitUntilIngressAvailableV1Beta1ContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, ingressName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilIngressAvailableV1Beta1ContextE waits until the Ingress resource has an endpoint provisioned for it, using networking.k8s.io/v1beta1 API. The ctx parameter supports cancellation and timeouts.

func WaitUntilJobSucceed deprecated added in v0.36.7

func WaitUntilJobSucceed(t testing.TestingT, options *KubectlOptions, jobName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilJobSucceed waits until requested job is succeeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error or if the check times out.

Deprecated: Use WaitUntilJobSucceedContext instead.

func WaitUntilJobSucceedContext added in v1.0.0

func WaitUntilJobSucceedContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, jobName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilJobSucceedContext waits until requested job is succeeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilJobSucceedContextE added in v1.0.0

func WaitUntilJobSucceedContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, jobName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilJobSucceedContextE waits until requested job is succeeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilJobSucceedE deprecated added in v0.36.7

func WaitUntilJobSucceedE(t testing.TestingT, options *KubectlOptions, jobName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilJobSucceedE waits until requested job is succeeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilJobSucceedContextE instead.

func WaitUntilNetworkPolicyAvailable deprecated added in v0.41.4

func WaitUntilNetworkPolicyAvailable(t testing.TestingT, options *KubectlOptions, networkPolicyName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilNetworkPolicyAvailable waits until the networkpolicy is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate).

Deprecated: Use WaitUntilNetworkPolicyAvailableContext instead.

func WaitUntilNetworkPolicyAvailableContext added in v1.0.0

func WaitUntilNetworkPolicyAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, networkPolicyName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilNetworkPolicyAvailableContext waits until the networkpolicy is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilNetworkPolicyAvailableContextE added in v1.0.0

func WaitUntilNetworkPolicyAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, networkPolicyName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilNetworkPolicyAvailableContextE waits until the networkpolicy is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts.

func WaitUntilNumPodsCreated deprecated added in v0.13.28

func WaitUntilNumPodsCreated(
	t testing.TestingT,
	options *KubectlOptions,
	filters metav1.ListOptions,
	desiredCount int,
	retries int,
	sleepBetweenRetries time.Duration,
)

WaitUntilNumPodsCreated waits until the desired number of pods are created that match the provided filter. This will retry the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if the retry times out.

Deprecated: Use WaitUntilNumPodsCreatedContext instead.

func WaitUntilNumPodsCreatedContext added in v1.0.0

func WaitUntilNumPodsCreatedContext(
	t testing.TestingT,
	ctx context.Context,
	options *KubectlOptions,
	filters metav1.ListOptions,
	desiredCount int,
	retries int,
	sleepBetweenRetries time.Duration,
)

WaitUntilNumPodsCreatedContext waits until the desired number of pods are created that match the provided filter. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilNumPodsCreatedContextE added in v1.0.0

func WaitUntilNumPodsCreatedContextE(
	t testing.TestingT,
	ctx context.Context,
	options *KubectlOptions,
	filters metav1.ListOptions,
	desiredCount int,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilNumPodsCreatedContextE waits until the desired number of pods are created that match the provided filter. The ctx parameter supports cancellation and timeouts.

func WaitUntilNumPodsCreatedE deprecated added in v0.13.28

func WaitUntilNumPodsCreatedE(
	t testing.TestingT,
	options *KubectlOptions,
	filters metav1.ListOptions,
	desiredCount int,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilNumPodsCreatedE waits until the desired number of pods are created that match the provided filter. This will retry the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilNumPodsCreatedContextE instead.

func WaitUntilPersistentVolumeClaimInStatus deprecated added in v0.41.25

func WaitUntilPersistentVolumeClaimInStatus(t testing.TestingT, options *KubectlOptions, pvcName string, pvcStatusPhase *corev1.PersistentVolumeClaimPhase, retries int, sleepBetweenRetries time.Duration)

WaitUntilPersistentVolumeClaimInStatus waits until the given PersistentVolumeClaim is the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error.

Deprecated: Use WaitUntilPersistentVolumeClaimInStatusContext instead.

func WaitUntilPersistentVolumeClaimInStatusContext added in v1.0.0

func WaitUntilPersistentVolumeClaimInStatusContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, pvcName string, pvcStatusPhase *corev1.PersistentVolumeClaimPhase, retries int, sleepBetweenRetries time.Duration)

WaitUntilPersistentVolumeClaimInStatusContext waits until the given PersistentVolumeClaim is the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilPersistentVolumeClaimInStatusContextE added in v1.0.0

func WaitUntilPersistentVolumeClaimInStatusContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, pvcName string, pvcStatusPhase *corev1.PersistentVolumeClaimPhase, retries int, sleepBetweenRetries time.Duration) error

WaitUntilPersistentVolumeClaimInStatusContextE waits until the given PersistentVolumeClaim is the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilPersistentVolumeClaimInStatusE deprecated added in v0.41.25

func WaitUntilPersistentVolumeClaimInStatusE(t testing.TestingT, options *KubectlOptions, pvcName string, pvcStatusPhase *corev1.PersistentVolumeClaimPhase, retries int, sleepBetweenRetries time.Duration) error

WaitUntilPersistentVolumeClaimInStatusE waits until the given PersistentVolumeClaim is the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error.

Deprecated: Use WaitUntilPersistentVolumeClaimInStatusContextE instead.

func WaitUntilPersistentVolumeInStatus deprecated added in v0.41.24

func WaitUntilPersistentVolumeInStatus(t testing.TestingT, options *KubectlOptions, pvName string, pvStatusPhase *corev1.PersistentVolumePhase, retries int, sleepBetweenRetries time.Duration)

WaitUntilPersistentVolumeInStatus waits until the given Persistent Volume is the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error.

Deprecated: Use WaitUntilPersistentVolumeInStatusContext instead.

func WaitUntilPersistentVolumeInStatusContext added in v1.0.0

func WaitUntilPersistentVolumeInStatusContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, pvName string, pvStatusPhase *corev1.PersistentVolumePhase, retries int, sleepBetweenRetries time.Duration)

WaitUntilPersistentVolumeInStatusContext waits until the given PersistentVolume is in the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilPersistentVolumeInStatusContextE added in v1.0.0

func WaitUntilPersistentVolumeInStatusContextE(
	t testing.TestingT,
	ctx context.Context,
	options *KubectlOptions,
	pvName string,
	pvStatusPhase *corev1.PersistentVolumePhase,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilPersistentVolumeInStatusContextE waits until the given PersistentVolume is in the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilPersistentVolumeInStatusE deprecated added in v0.41.24

func WaitUntilPersistentVolumeInStatusE(
	t testing.TestingT,
	options *KubectlOptions,
	pvName string,
	pvStatusPhase *corev1.PersistentVolumePhase,
	retries int,
	sleepBetweenRetries time.Duration,
) error

WaitUntilPersistentVolumeInStatusE waits until the given PersistentVolume is in the given status phase, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilPersistentVolumeInStatusContextE instead.

func WaitUntilPodAvailable deprecated added in v0.13.21

func WaitUntilPodAvailable(t testing.TestingT, options *KubectlOptions, podName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilPodAvailable waits until all of the containers within the pod are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. This will fail the test if there is an error or if the check times out.

Deprecated: Use WaitUntilPodAvailableContext instead.

func WaitUntilPodAvailableContext added in v1.0.0

func WaitUntilPodAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilPodAvailableContext waits until all of the containers within the pod are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilPodAvailableContextE added in v1.0.0

func WaitUntilPodAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, podName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilPodAvailableContextE waits until all of the containers within the pod are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try. The ctx parameter supports cancellation and timeouts.

func WaitUntilPodAvailableE deprecated added in v0.13.21

func WaitUntilPodAvailableE(t testing.TestingT, options *KubectlOptions, podName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilPodAvailableE waits until all of the containers within the pod are ready and started, retrying the check for the specified amount of times, sleeping for the provided duration between each try.

Deprecated: Use WaitUntilPodAvailableContextE instead.

func WaitUntilSecretAvailable deprecated added in v0.30.18

func WaitUntilSecretAvailable(t testing.TestingT, options *KubectlOptions, secretName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilSecretAvailable waits until the secret is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate).

Deprecated: Use WaitUntilSecretAvailableContext instead.

func WaitUntilSecretAvailableContext added in v1.0.0

func WaitUntilSecretAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, secretName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilSecretAvailableContext waits until the secret is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilSecretAvailableContextE added in v1.0.0

func WaitUntilSecretAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, secretName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilSecretAvailableContextE waits until the secret is present on the cluster in cases where it is not immediately available (for example, when using ClusterIssuer to request a certificate). The ctx parameter supports cancellation and timeouts.

func WaitUntilServiceAvailable deprecated added in v0.13.16

func WaitUntilServiceAvailable(t testing.TestingT, options *KubectlOptions, serviceName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilServiceAvailable waits until the service endpoint is ready to accept traffic.

Deprecated: Use WaitUntilServiceAvailableContext instead.

func WaitUntilServiceAvailableContext added in v1.0.0

func WaitUntilServiceAvailableContext(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceName string, retries int, sleepBetweenRetries time.Duration)

WaitUntilServiceAvailableContext waits until the service endpoint is ready to accept traffic. The ctx parameter supports cancellation and timeouts. This will fail the test if there is an error.

func WaitUntilServiceAvailableContextE added in v1.0.0

func WaitUntilServiceAvailableContextE(t testing.TestingT, ctx context.Context, options *KubectlOptions, serviceName string, retries int, sleepBetweenRetries time.Duration) error

WaitUntilServiceAvailableContextE waits until the service endpoint is ready to accept traffic. The ctx parameter supports cancellation and timeouts.

Types

type CronJobNotSucceeded added in v0.50.0

type CronJobNotSucceeded struct {
	// contains filtered or unexported fields
}

CronJobNotSucceeded is returned when a Kubernetes cron job didn't successfully schedule a job.

func NewCronJobNotSucceeded added in v0.50.0

func NewCronJobNotSucceeded(cronJob *batchv1.CronJob) CronJobNotSucceeded

NewCronJobNotSucceeded create error for case when CronJob didn't schedule a job.

func (CronJobNotSucceeded) Error added in v0.50.0

func (err CronJobNotSucceeded) Error() string

Error format message for cron job error.

type DaemonSetNotAvailable added in v1.0.0

type DaemonSetNotAvailable struct {
	// contains filtered or unexported fields
}

DaemonSetNotAvailable is returned when a Kubernetes daemonset has not yet rolled out the desired number of pods.

func NewDaemonSetNotAvailableError added in v1.0.0

func NewDaemonSetNotAvailableError(ds *appsv1.DaemonSet) DaemonSetNotAvailable

NewDaemonSetNotAvailableError returns a DaemonSetNotAvailable struct when Kubernetes deems a daemonset is not available

func (DaemonSetNotAvailable) Error added in v1.0.0

func (err DaemonSetNotAvailable) Error() string

Error is a simple function to return a formatted error message as a string

type DeploymentNotAvailable added in v0.41.21

type DeploymentNotAvailable struct {
	// contains filtered or unexported fields
}

DeploymentNotAvailable is returned when a Kubernetes deployment is not yet available to accept traffic.

func NewDeploymentNotAvailableError added in v0.41.21

func NewDeploymentNotAvailableError(deploy *appsv1.Deployment) DeploymentNotAvailable

NewDeploymentNotAvailableError returns a DeploymentNotAvailable struct when Kubernetes deems a deployment is not available

func (DeploymentNotAvailable) Error added in v0.41.21

func (err DeploymentNotAvailable) Error() string

Error is a simple function to return a formatted error message as a string

type DesiredNumberOfPodsNotCreated added in v0.13.28

type DesiredNumberOfPodsNotCreated struct {
	Filter       metav1.ListOptions
	DesiredCount int
}

DesiredNumberOfPodsNotCreated is returned when the number of pods matching a filter condition does not match the desired number of Pods.

func (DesiredNumberOfPodsNotCreated) Error added in v0.13.28

Error is a simple function to return a formatted error message as a string

type IngressNotAvailable added in v0.14.5

type IngressNotAvailable struct {
	// contains filtered or unexported fields
}

IngressNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.

func (IngressNotAvailable) Error added in v0.14.5

func (err IngressNotAvailable) Error() string

Error is a simple function to return a formatted error message as a string

type IngressNotAvailableV1Beta1 added in v0.34.0

type IngressNotAvailableV1Beta1 struct {
	// contains filtered or unexported fields
}

IngressNotAvailableV1Beta1 is returned when a Kubernetes service is not yet available to accept traffic.

func (IngressNotAvailableV1Beta1) Error added in v0.34.0

func (err IngressNotAvailableV1Beta1) Error() string

Error is a simple function to return a formatted error message as a string

type JSONPathExtractJSONPathErr added in v0.30.16

type JSONPathExtractJSONPathErr struct {
	// contains filtered or unexported fields
}

JSONPathExtractJSONPathErr is returned when the jsonpath unmarshal routine fails to extract the given JSON path from the JSON blob.

func (JSONPathExtractJSONPathErr) Error added in v0.30.16

func (err JSONPathExtractJSONPathErr) Error() string

Error returns a formatted error message as a string.

func (JSONPathExtractJSONPathErr) Unwrap added in v1.0.0

func (err JSONPathExtractJSONPathErr) Unwrap() error

Unwrap returns the underlying error for use with errors.Is and errors.As.

type JSONPathMalformedJSONErr added in v0.30.16

type JSONPathMalformedJSONErr struct {
	// contains filtered or unexported fields
}

JSONPathMalformedJSONErr is returned when the jsonpath unmarshal routine fails to parse the given JSON blob.

func (JSONPathMalformedJSONErr) Error added in v0.30.16

func (err JSONPathMalformedJSONErr) Error() string

Error returns a formatted error message as a string.

func (JSONPathMalformedJSONErr) Unwrap added in v1.0.0

func (err JSONPathMalformedJSONErr) Unwrap() error

Unwrap returns the underlying error for use with errors.Is and errors.As.

type JSONPathMalformedJSONPathErr added in v0.30.16

type JSONPathMalformedJSONPathErr struct {
	// contains filtered or unexported fields
}

JSONPathMalformedJSONPathErr is returned when the jsonpath unmarshal routine fails to parse the given JSON path string.

func (JSONPathMalformedJSONPathErr) Error added in v0.30.16

Error returns a formatted error message as a string.

func (JSONPathMalformedJSONPathErr) Unwrap added in v1.0.0

func (err JSONPathMalformedJSONPathErr) Unwrap() error

Unwrap returns the underlying error for use with errors.Is and errors.As.

type JSONPathMalformedJSONPathResultErr added in v0.30.16

type JSONPathMalformedJSONPathResultErr struct {
	// contains filtered or unexported fields
}

JSONPathMalformedJSONPathResultErr is returned when the jsonpath unmarshal routine fails to unmarshal the resulting data from extraction.

func (JSONPathMalformedJSONPathResultErr) Error added in v0.30.16

Error returns a formatted error message as a string.

func (JSONPathMalformedJSONPathResultErr) Unwrap added in v1.0.0

Unwrap returns the underlying error for use with errors.Is and errors.As.

type JobNotSucceeded added in v0.36.7

type JobNotSucceeded struct {
	// contains filtered or unexported fields
}

JobNotSucceeded is returned when a Kubernetes job is not Succeeded

func NewJobNotSucceeded added in v0.36.7

func NewJobNotSucceeded(job *batchv1.Job) JobNotSucceeded

NewJobNotSucceeded returns a JobNotSucceeded when the status of the job is not Succeeded

func (JobNotSucceeded) Error added in v0.36.7

func (err JobNotSucceeded) Error() string

Error is a simple function to return a formatted error message as a string

type KubeResourceType added in v0.13.28

type KubeResourceType int

KubeResourceType is an enum representing known resource types that can support port forwarding

const (
	// ResourceTypePod is a k8s pod kind identifier
	ResourceTypePod KubeResourceType = iota
	// ResourceTypeDeployment is a k8s deployment kind identifier
	ResourceTypeDeployment
	// ResourceTypeService is a k8s service kind identifier
	ResourceTypeService
)

func (KubeResourceType) String added in v0.13.28

func (resourceType KubeResourceType) String() string

type KubectlOptions added in v0.13.16

type KubectlOptions struct {
	Env            map[string]string
	RestConfig     *rest.Config
	Logger         *logger.Logger
	ContextName    string
	ConfigPath     string
	Namespace      string
	RequestTimeout time.Duration
	InClusterAuth  bool
}

KubectlOptions represents common options necessary to specify for all Kubectl calls

func NewKubectlOptions added in v0.13.16

func NewKubectlOptions(contextName string, configPath string, namespace string) *KubectlOptions

NewKubectlOptions will return a pointer to new instance of KubectlOptions with the configured options

func NewKubectlOptionsWithInClusterAuth added in v0.35.3

func NewKubectlOptionsWithInClusterAuth() *KubectlOptions

NewKubectlOptionsWithInClusterAuth will return a pointer to a new instance of KubectlOptions with the InClusterAuth field set to true

func NewKubectlOptionsWithRestConfig added in v0.46.5

func NewKubectlOptionsWithRestConfig(config *rest.Config, namespace string) *KubectlOptions

NewKubectlOptionsWithRestConfig will return a pointer to a new instance of KubectlOptions with pre-built config object

func (*KubectlOptions) GetConfigPath added in v0.13.28

func (kubectlOptions *KubectlOptions) GetConfigPath(t testing.TestingT) (string, error)

GetConfigPath will return a sensible default if the config path is not set on the options.

type MalformedNodeID added in v0.13.16

type MalformedNodeID struct {
	// contains filtered or unexported fields
}

MalformedNodeID is returned when a Kubernetes node has a malformed node id scheme

func NewMalformedNodeIDError added in v0.13.16

func NewMalformedNodeIDError(node *corev1.Node) MalformedNodeID

NewMalformedNodeIDError returns a MalformedNodeID struct when Kubernetes deems that a NodeID is malformed

func (MalformedNodeID) Error added in v0.13.16

func (err MalformedNodeID) Error() string

Error is a simple function to return a formatted error message as a string

type NoNodesInKubernetes added in v0.13.16

type NoNodesInKubernetes struct{}

NoNodesInKubernetes is returned when the Kubernetes cluster has no nodes registered.

func NewNoNodesInKubernetesError added in v0.13.16

func NewNoNodesInKubernetesError() NoNodesInKubernetes

NewNoNodesInKubernetesError returns a NoNodesInKubernetes struct when it is deemed that there are no Kubernetes nodes registered

func (NoNodesInKubernetes) Error added in v0.13.16

func (err NoNodesInKubernetes) Error() string

Error is a simple function to return a formatted error message as a string

type NodeHasNoHostname added in v0.13.16

type NodeHasNoHostname struct {
	// contains filtered or unexported fields
}

NodeHasNoHostname is returned when a Kubernetes node has no discernible hostname

func NewNodeHasNoHostnameError added in v0.13.16

func NewNodeHasNoHostnameError(node *corev1.Node) NodeHasNoHostname

NewNodeHasNoHostnameError returns a NodeHasNoHostname struct when it is deemed that the provided node has no hostname

func (NodeHasNoHostname) Error added in v0.13.16

func (err NodeHasNoHostname) Error() string

Error is a simple function to return a formatted error message as a string

type PersistentVolumeClaimNotInStatus added in v0.41.25

type PersistentVolumeClaimNotInStatus struct {
	// contains filtered or unexported fields
}

PersistentVolumeClaimNotInStatus is returned when a Kubernetes PersistentVolumeClaim is not in the expected status phase

func NewPersistentVolumeClaimNotInStatusError added in v0.41.25

func NewPersistentVolumeClaimNotInStatusError(pvc *corev1.PersistentVolumeClaim, pvcStatusPhase *corev1.PersistentVolumeClaimPhase) PersistentVolumeClaimNotInStatus

NewPersistentVolumeClaimNotInStatusError returns a PersistentVolumeClaimNotInStatus struct when the given PersistentVolumeClaim is not in the expected status phase

func (PersistentVolumeClaimNotInStatus) Error added in v0.41.25

Error is a simple function to return a formatted error message as a string

type PersistentVolumeNotInStatus added in v0.41.24

type PersistentVolumeNotInStatus struct {
	// contains filtered or unexported fields
}

PersistentVolumeNotInStatus is returned when a Kubernetes PersistentVolume is not in the expected status phase

func NewPersistentVolumeNotInStatusError added in v0.41.24

func NewPersistentVolumeNotInStatusError(pv *corev1.PersistentVolume, pvStatusPhase *corev1.PersistentVolumePhase) PersistentVolumeNotInStatus

NewPersistentVolumeNotInStatusError returns a PersistentVolumeNotInStatus struct when the given Persistent Volume is not in the expected status phase

func (PersistentVolumeNotInStatus) Error added in v0.41.24

func (err PersistentVolumeNotInStatus) Error() string

Error is a simple function to return a formatted error message as a string

type PodNotAvailable added in v0.13.21

type PodNotAvailable struct {
	// contains filtered or unexported fields
}

PodNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.

func NewPodNotAvailableError added in v0.13.21

func NewPodNotAvailableError(pod *corev1.Pod) PodNotAvailable

NewPodNotAvailableError returns a PodNotAvailable struct when Kubernetes deems a pod is not available

func (PodNotAvailable) Error added in v0.13.21

func (err PodNotAvailable) Error() string

Error is a simple function to return a formatted error message as a string

type PortNotFoundInPodError added in v1.0.0

type PortNotFoundInPodError struct {
	PortName string
	PodName  string
}

PortNotFoundInPodError is returned when a named port is not found in any container of a pod.

func (PortNotFoundInPodError) Error added in v1.0.0

func (err PortNotFoundInPodError) Error() string

Error returns a formatted error message as a string.

type ServiceAccountTokenNotAvailable added in v0.13.24

type ServiceAccountTokenNotAvailable struct {
	Name string
}

ServiceAccountTokenNotAvailable is returned when a Kubernetes ServiceAccount does not have a token provisioned yet.

func (ServiceAccountTokenNotAvailable) Error added in v0.13.24

Error is a simple function to return a formatted error message as a string

type ServiceNotAvailable added in v0.13.16

type ServiceNotAvailable struct {
	// contains filtered or unexported fields
}

ServiceNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.

func NewServiceNotAvailableError added in v0.13.16

func NewServiceNotAvailableError(service *corev1.Service) ServiceNotAvailable

NewServiceNotAvailableError returns a ServiceNotAvailable struct when Kubernetes deems a service is not available

func (ServiceNotAvailable) Error added in v0.13.16

func (err ServiceNotAvailable) Error() string

Error is a simple function to return a formatted error message as a string

type TargetPortNotFoundError added in v1.0.0

type TargetPortNotFoundError struct {
	ServiceName string
	TargetPort  int
}

TargetPortNotFoundError is returned when a target port is not found in a service definition.

func (TargetPortNotFoundError) Error added in v1.0.0

func (err TargetPortNotFoundError) Error() string

Error returns a formatted error message as a string.

type Tunnel added in v0.13.28

type Tunnel struct {
	// contains filtered or unexported fields
}

Tunnel is the main struct that configures and manages port forwading tunnels to Kubernetes resources.

func NewTunnel added in v0.13.28

func NewTunnel(kubectlOptions *KubectlOptions, resourceType KubeResourceType, resourceName string, local int, remote int) *Tunnel

NewTunnel creates a new tunnel with NewTunnelWithLogger, setting logger.Terratest as the logger.

func NewTunnelWithLogger added in v0.30.10

func NewTunnelWithLogger(
	kubectlOptions *KubectlOptions,
	resourceType KubeResourceType,
	resourceName string,
	local int,
	remote int,
	logger logger.TestLogger,
) *Tunnel

NewTunnelWithLogger will create a new Tunnel struct with the provided logger. Note that if you use 0 for the local port, an open port on the host system will be selected automatically, and the Tunnel struct will be updated with the selected port.

func (*Tunnel) Close added in v0.13.28

func (tunnel *Tunnel) Close()

Close disconnects a tunnel connection by closing the StopChan, thereby stopping the goroutine.

func (*Tunnel) Endpoint added in v0.13.28

func (tunnel *Tunnel) Endpoint() string

Endpoint returns the tunnel endpoint

func (*Tunnel) ForwardPort added in v0.13.28

func (tunnel *Tunnel) ForwardPort(t testing.TestingT)

ForwardPort opens a tunnel to a kubernetes resource, as specified by the provided tunnel struct. This will fail the test if there is an error attempting to open the port.

func (*Tunnel) ForwardPortE added in v0.13.28

func (tunnel *Tunnel) ForwardPortE(t testing.TestingT) error

ForwardPortE opens a tunnel to a kubernetes resource, as specified by the provided tunnel struct.

type UnknownKubeResourceType added in v0.13.28

type UnknownKubeResourceType struct {
	ResourceType KubeResourceType
}

UnknownKubeResourceType is returned if the given resource type does not match the list of known resource types.

func (UnknownKubeResourceType) Error added in v0.13.28

func (err UnknownKubeResourceType) Error() string

type UnknownServicePort added in v0.13.16

type UnknownServicePort struct {
	// contains filtered or unexported fields
}

UnknownServicePort is returned when the given service port is not an exported port of the service.

func NewUnknownServicePortError added in v0.13.16

func NewUnknownServicePortError(service *corev1.Service, port int32) UnknownServicePort

NewUnknownServicePortError returns an UnknownServicePort struct when it is deemed that Kubernetes does not know of the provided Service Port

func (UnknownServicePort) Error added in v0.13.16

func (err UnknownServicePort) Error() string

Error is a simple function to return a formatted error message as a string

type UnknownServiceType added in v0.13.16

type UnknownServiceType struct {
	// contains filtered or unexported fields
}

UnknownServiceType is returned when a Kubernetes service has a type that is not yet handled by the test functions.

func NewUnknownServiceTypeError added in v0.13.16

func NewUnknownServiceTypeError(service *corev1.Service) UnknownServiceType

NewUnknownServiceTypeError returns an UnknownServiceType struct when is it deemed that Kubernetes does not know the service type provided

func (UnknownServiceType) Error added in v0.13.16

func (err UnknownServiceType) Error() string

Error is a simple function to return a formatted error message as a string

Jump to

Keyboard shortcuts

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