package
0.48.2
Repository: https://github.com/gruntwork-io/terratest.git
Documentation: pkg.go.dev

# Functions

AddConfigContextForServiceAccountE will add a new config context that binds the ServiceAccount auth token to the Kubernetes cluster of the current config context.
AreAllNodesReady checks if all nodes are ready in the Kubernetes cluster targeted by the current config context.
AreAllNodesReadyE checks if all nodes are ready in the Kubernetes cluster targeted by the current config context.
CanIDo returns whether or not the provided action is allowed by the client configured by the provided kubectl option.
CanIDoE returns whether or not the provided action is allowed by the client configured by the provided kubectl option.
CopyHomeKubeConfigToTemp will copy the kubeconfig in the home directory to a temp file.
CopyHomeKubeConfigToTempE will copy the kubeconfig in the home directory to a temp file.
CreateNamespace will create a new Kubernetes namespace on the cluster targeted by the provided options.
CreateNamespaceE will create a new Kubernetes namespace on the cluster targeted by the provided options.
CreateNamespaceWithMetadata will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata.
CreateNamespaceWithMetadataE will create a new Kubernetes namespace on the cluster targeted by the provided options and with the provided metadata.
CreateServiceAccount will create a new service account resource in the provided namespace with the given name.
CreateServiceAccountE will create a new service account resource in the provided namespace with the given name.
DeleteConfigContextE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it.
DeleteConfigContextWithPathE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it.
DeleteNamespace will delete the requested namespace from the Kubernetes cluster targeted by the provided options.
DeleteNamespaceE will delete the requested namespace from the Kubernetes cluster targeted by the provided options.
Given a node, return the ip address, preferring the external IP.
Given the desired servicePort, return the allocated nodeport.
GetAvailablePort retrieves an available port on the host machine.
GetAvailablePortE retrieves an available port on the host machine.
GetClusterRole returns a Kubernetes ClusterRole resource with the given name.
GetClusterRoleE returns a Kubernetes ClusterRole resource with the given name.
GetConfigMap returns a Kubernetes configmap resource in the provided namespace with the given name.
GetConfigMapE returns a Kubernetes configmap resource in the provided namespace with the given name.
GetDaemonSet returns a Kubernetes daemonset resource in the provided namespace with the given name.
GetDaemonSetE returns a Kubernetes daemonset resource in the provided namespace with the given name.
GetDeployment returns a Kubernetes deployment resource in the provided namespace with the given name.
GetDeploymentE returns a Kubernetes deployment resource in the provided namespace with the given name.
GetIngress returns a Kubernetes Ingress resource in the provided namespace with the given name.
GetIngressE returns a Kubernetes Ingress resource in the provided namespace with the given name.
GetIngressV1Beta1 returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1 API.
GetIngressV1Beta1E returns a Kubernetes Ingress resource in the provided namespace with the given name, using networking.k8s.io/v1beta1.
GetJob returns a Kubernetes job resource in the provided namespace with the given name.
GetJobE returns a Kubernetes job resource in the provided namespace with the given name.
GetKubeConfigPathE determines which file path to use as the kubectl config path.
GetKubernetesClientE returns a Kubernetes API client that can be used to make requests.
GetKubernetesClientFromOptionsE returns a Kubernetes API client given a configured KubectlOptions object.
GetKubernetesClusterVersion returns the Kubernetes cluster version.
GetKubernetesClusterVersion returns the Kubernetes cluster version given a configured KubectlOptions object.
GetNamespace will query the Kubernetes cluster targeted by the provided options for the requested namespace.
GetNamespaceE will query the Kubernetes cluster targeted by the provided options for the requested namespace.
GetNetworkPolicy returns a Kubernetes networkpolicy resource in the provided namespace with the given name.
GetNetworkPolicyE returns a Kubernetes networkpolicy resource in the provided namespace with the given name.
GetNodes queries Kubernetes for information about the worker nodes registered to the cluster.
GetNodesByFilterE queries Kubernetes for information about the worker nodes registered to the cluster, filtering the list of nodes using the provided ListOptions.
GetNodesE queries Kubernetes for information about the worker nodes registered to the cluster.
GetPersistentVolume returns a Kubernetes PersistentVolume resource with the given name.
GetPersistentVolumeClaim returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name.
GetPersistentVolumeClaimE returns a Kubernetes PersistentVolumeClaim resource in the provided namespace with the given name.
GetPersistentVolumeE returns a Kubernetes PersistentVolume resource with the given name.
GetPod returns a Kubernetes pod resource in the provided namespace with the given name.
GetPodE returns a Kubernetes pod resource in the provided namespace with the given name.
GetPodLogsE returns the logs of a Pod at the time when the function was called.
GetPodLogsE returns the logs of a Pod at the time when the function was called.
GetReadyNodes queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state.
GetReadyNodesE queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state.
GetReplicaSet returns a Kubernetes replicaset resource in the provided namespace with the given name.
GetReplicaSetE returns a Kubernetes replicaset resource in the provided namespace with the given name.
GetRole returns a Kubernetes role resource in the provided namespace with the given name.
GetRoleE returns a Kubernetes role resource in the provided namespace with the given name.
GetSecret returns a Kubernetes secret resource in the provided namespace with the given name.
GetSecretE returns a Kubernetes secret resource in the provided namespace with the given name.
GetService returns a Kubernetes service resource in the provided namespace with the given name.
GetServiceAccount returns a Kubernetes service account resource in the provided namespace with the given name.
GetServiceAccountAuthToken will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount.
GetServiceAccountAuthTokenE will retrieve the ServiceAccount token from the cluster so it can be used to authenticate requests as that ServiceAccount.
GetServiceAccountE returns a Kubernetes service account resource in the provided namespace with the given name.
GetServiceE returns a Kubernetes service resource in the provided namespace with the given name.
GetServiceEndpoint will return the service access point.
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.
IsDeploymentAvailable returns true if all pods within the deployment are ready and started.
IsIngressAvailable returns true if the Ingress endpoint is provisioned and available.
IsIngressAvailableV1Beta1 returns true if the Ingress endpoint is provisioned and available, using networking.k8s.io/v1beta1 API.
IsJobSucceeded returns true when the job status condition "Complete" is true.
IsMinikubeE returns true if the underlying kubernetes cluster is Minikube.
IsNodeReady takes a Kubernetes Node information object and checks if the Node is in the ready state.
IsPersistentVolumeClaimInStatus returns true if the given PersistentVolumeClaim is in the given status phase.
IsPersistentVolumeInStatus returns true if the given PersistentVolume is in the given status phase.
IsPodAvailable returns true if the all of the containers within the pod are ready and started.
IsServiceAvailable returns true if the service endpoint is ready to accept traffic.
KubeConfigPathFromHomeDirE returns a string to the default Kubernetes config path in the home directory.
KubectlApply will take in a file path and apply it to the cluster targeted by KubectlOptions.
KubectlApplyE will take in a file path and apply it to the cluster targeted by KubectlOptions.
KubectlApplyFromKustomize will take in a kustomization directory path and apply it to the cluster targeted by KubectlOptions.
KubectlApplyFromKustomizeE will take in a kustomization directory path and apply it to the cluster targeted by KubectlOptions.
KubectlApplyFromString will take in a kubernetes resource config as a string and apply it on the cluster specified by the provided kubectl options.
KubectlApplyFromStringE will take in a kubernetes resource config as a string and apply it on the cluster specified by the provided kubectl options.
KubectlDelete will take in a file path and delete it from the cluster targeted by KubectlOptions.
KubectlDeleteE will take in a file path and delete it from the cluster targeted by KubectlOptions.
KubectlDeleteFromKustomize will take in a kustomization directory path and delete it from the cluster targeted by KubectlOptions.
KubectlDeleteFromKustomizeE will take in a kustomization directory path and delete it from the cluster targeted by KubectlOptions.
KubectlDeleteFromString will take in a kubernetes resource config as a string and delete it on the cluster specified by the provided kubectl options.
KubectlDeleteFromStringE will take in a kubernetes resource config as a string and delete it on the cluster specified by the provided kubectl options.
ListDaemonSets will look for daemonsets in the given namespace that match the given filters and return them.
ListDaemonSetsE will look for daemonsets in the given namespace that match the given filters and return them.
ListDeployments will look for deployments in the given namespace that match the given filters and return them.
ListDeploymentsE will look for deployments in the given namespace that match the given filters and return them.
ListEvents will retrieve the Events in the given namespace that match the given filters and return them.
ListEventsE will retrieve the Events that match the given filters and return them.
ListIngresses will look for Ingress resources in the given namespace that match the given filters and return them.
ListIngressesE will look for Ingress resources in the given namespace that match the given filters and return them.
ListIngressesV1Beta1 will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API.
ListIngressesV1Beta1E will look for Ingress resources in the given namespace that match the given filters and return them, using networking.k8s.io/v1beta1 API.
ListJobs will look for Jobs in the given namespace that match the given filters and return them.
ListJobsE will look for jobs in the given namespace that match the given filters and return them.
ListPersistentVolumeClaims will look for PersistentVolumeClaims in the given namespace that match the given filters and return them.
ListPersistentVolumeClaimsE will look for PersistentVolumeClaims in the given namespace that match the given filters and return them.
ListPersistentVolumes will look for PersistentVolumes in the given namespace that match the given filters and return them.
ListPersistentVolumesE will look for PersistentVolumes that match the given filters and return them.
ListPods will look for pods in the given namespace that match the given filters and return them.
ListPodsE will look for pods in the given namespace that match the given filters and return them.
ListReplicaSets will look for replicasets in the given namespace that match the given filters and return them.
ListReplicaSetsE will look for replicasets in the given namespace that match the given filters and return them.
ListServices will look for services in the given namespace that match the given filters and return them.
ListServicesE will look for services in the given namespace that match the given filters and return them.
LoadApiClientConfigE will load a ClientConfig object from a file path that points to a location on disk containing a kubectl config, with the requested context loaded.
LoadConfigFromPath will load a ClientConfig object from a file path that points to a location on disk containing a kubectl config.
NewDeploymentNotAvailableError returnes a DeploymentNotAvailable struct when Kubernetes deems a deployment is not available.
NewJobNotSucceeded returnes a JobNotSucceeded when the status of the job is not Succeeded.
NewKubectlOptions will return a pointer to new instance of KubectlOptions with the configured options.
NewKubectlOptionsWithInClusterAuth will return a pointer to a new instance of KubectlOptions with the InClusterAuth field set to true.
NewKubectlOptionsWithRestConfig will return a pointer to a new instance of KubectlOptions with pre-built config object.
NewMalformedNodeIDError returns a MalformedNodeID struct when Kubernetes deems that a NodeID is malformed.
NewNodeHasNoHostnameError returns a NodeHasNoHostname struct when it is deemed that the provided node has no hostname.
NewNoNodesInKubernetesError returns a NoNodesInKubernetes struct when it is deemed that there are no Kubernetes nodes registered.
NewPersistentVolumeClaimNotInStatusError returns a PersistentVolumeClaimNotInStatus struct when the given PersistentVolumeClaim is not in the expected status phase.
NewPersistentVolumeNotInStatusError returns a PersistentVolumeNotInStatus struct when the given Persistent Volume is not in the expected status phase.
NewPodNotAvailableError returnes a PodNotAvailable struct when Kubernetes deems a pod is not available.
NewServiceNotAvailableError returnes a ServiceNotAvailable struct when Kubernetes deems a service is not available.
NewTunnel creates a new tunnel with NewTunnelWithLogger, setting logger.Terratest as the logger.
NewTunnelWithLogger will create a new Tunnel struct with the provided logger.
NewUnknownServicePortError returns an UnknownServicePort struct when it is deemed that Kuberenetes does not know of the provided Service Port.
NewUnknownServiceTypeError returns an UnknownServiceType struct when is it deemed that Kubernetes does not know the service type provided.
RemoveOrphanedClusterAndAuthInfoConfig will remove all configurations related to clusters and users that have no contexts associated with it.
RunKubectl will call kubectl using the provided options and args, failing the test on error.
RunKubectlAndGetOutputE will call kubectl using the provided options and args, returning the output of stdout and stderr.
RunKubectlE will call kubectl using the provided options and args.
StoreConfigToTempFile will store the provided config data to a temporary file created on the os and return the filename.
StoreConfigToTempFileE will store the provided config data to a temporary file created on the os and return the filename, or error.
UnmarshalJSONPath allows you to use an arbitrary JSONPath string to query a json blob and unmarshal the resulting output into a go object.
UnmarshalJSONPathE allows you to use an arbitrary JSONPath string to query a json blob and unmarshal the resulting output into a go object.
UpsertConfigContext will update or insert a new context to the provided config, binding the provided cluster to the provided user.
WaitUntilAllNodesReady continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries.
WaitUntilAllNodesReadyE continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries.
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).
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.
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.
WaitUntilIngressAvailable waits until the Ingress resource has an endpoint provisioned for it.
WaitUntilIngressAvailableV1Beta1 waits until the Ingress resource has an endpoint provisioned for it, using networking.k8s.io/v1beta1 API.
WaitUntilJobSucceed waits until requested job is suceeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try.
WaitUntilJobSucceedE waits until requested job is succeeded, retrying the check for the specified amount of times, sleeping for the provided duration between each try.
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).
WaitUntilNumPodsCreated waits until the desired number of pods are created that match the provided filter.
WaitUntilNumPodsCreatedE waits until the desired number of pods are created that match the provided filter.
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.
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.
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.
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.
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.
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.
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).
WaitUntilServiceAvailable waits until the service endpoint is ready to accept traffic.

# Constants

ResourceTypeDeployment is a k8s deployment kind identifier.
ResourceTypePod is a k8s pod kind identifier.
ResourceTypeService is a k8s service kind identifier.

# Structs

DeploymentNotAvailable is returned when a Kubernetes deployment is not yet available to accept traffic.
DesiredNumberOfPodsNotCreated is returned when the number of pods matching a filter condition does not match the desired number of Pods.
IngressNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.
IngressNotAvailableV1Beta1 is returned when a Kubernetes service is not yet available to accept traffic.
JobNotSucceeded is returned when a Kubernetes job is not Succeeded.
JSONPathExtractJSONPathErr is returned when the jsonpath unmarshal routine fails to extract the given JSON path from the JSON blob.
JSONPathMalformedJSONErr is returned when the jsonpath unmarshal routine fails to parse the given JSON blob.
JSONPathMalformedJSONPathErr is returned when the jsonpath unmarshal routine fails to parse the given JSON path string.
JSONPathMalformedJSONPathResultErr is returned when the jsonpath unmarshal routine fails to unmarshal the resulting data from extraction.
KubectlOptions represents common options necessary to specify for all Kubectl calls.
MalformedNodeID is returned when a Kubernetes node has a malformed node id scheme.
NodeHasNoHostname is returned when a Kubernetes node has no discernible hostname.
NoNodesInKubernetes is returned when the Kubernetes cluster has no nodes registered.
PersistentVolumeClaimNotInStatus is returned when a Kubernetes PersistentVolumeClaim is not in the expected status phase.
PersistentVolumeNotInStatus is returned when a Kubernetes PersistentVolume is not in the expected status phase.
PodNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.
ServiceAccountTokenNotAvailable is returned when a Kubernetes ServiceAccount does not have a token provisioned yet.
ServiceNotAvailable is returned when a Kubernetes service is not yet available to accept traffic.
Tunnel is the main struct that configures and manages port forwading tunnels to Kubernetes resources.
UnknownKubeResourceType is returned if the given resource type does not match the list of known resource types.
UnknownServicePort is returned when the given service port is not an exported port of the service.
UnknownServiceType is returned when a Kubernetes service has a type that is not yet handled by the test functions.

# Type aliases

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