pod

package
v1.6.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const LabelLogOnPodFailure = "log-on-pod-failure"

LabelLogOnPodFailure can be used to mark which Pods will have their logs logged in the case of a test failure. By default, if there are no Pods with this label, only the first 5 Pods will have their logs fetched.

Variables

This section is empty.

Functions

func DumpAllPodInfoForNamespace

func DumpAllPodInfoForNamespace(c clientset.Interface, namespace, reportDir string)

DumpAllPodInfoForNamespace logs all pod information for a given namespace.

func GetPodLogs

func GetPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)

GetPodLogs returns the logs of the specified container (namespace/pod/container).

func GetPreviousPodLogs

func GetPreviousPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)

GetPreviousPodLogs returns the logs of the previous instance of the specified container (namespace/pod/container).

func LogPodStates

func LogPodStates(pods []v1.Pod)

LogPodStates logs basic info of provided pods for debugging.

func PodRunningReady

func PodRunningReady(p *v1.Pod) (bool, error)

PodRunningReady checks whether pod p's phase is running and it has a ready condition of status true. This function is copied from k8s.io/kubernetes/test/utils/conditions.go @v1.23.17

func WaitForPodCondition

func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, condition podCondition) error

WaitForPodCondition waits a pods to be matched to the given condition.

func WaitForPodNotFoundInNamespace

func WaitForPodNotFoundInNamespace(c clientset.Interface, podName, ns string, timeout time.Duration) error

WaitForPodNotFoundInNamespace returns an error if it takes too long for the pod to fully terminate. Unlike `waitForPodTerminatedInNamespace`, the pod's Phase and Reason are ignored. If the pod Get api returns IsNotFound then the wait stops and nil is returned. If the Get api returns an error other than "not found" then that error is returned and the wait stops.

func WaitForPodSuccessInNamespaceTimeout

func WaitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName, namespace string, timeout time.Duration) error

WaitForPodSuccessInNamespaceTimeout returns nil if the pod reached state success, or an error if it reached failure or ran too long.

func WaitForPodTerminatedInNamespace

func WaitForPodTerminatedInNamespace(c clientset.Interface, podName, reason, namespace string) error

WaitForPodTerminatedInNamespace returns an error if it takes too long for the pod to terminate, if the pod Get api returns an error (IsNotFound or other), or if the pod failed (and thus did not terminate) with an unexpected reason. Typically called to test that the passed-in pod is fully terminated (reason==""), but may be called to detect if a pod did *not* terminate according to the supplied reason.

func WaitForPodToDisappear

func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labels.Selector, interval, timeout time.Duration) error

WaitForPodToDisappear waits the given timeout duration for the specified pod to disappear.

func WaitForPodsRunningReady

func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedNotReadyPods int32, timeout time.Duration, ignoreLabels map[string]string) error

WaitForPodsRunningReady waits up to timeout to ensure that all pods in namespace ns are either running and ready, or failed but controlled by a controller. Also, it ensures that at least minPods are running and ready. It has separate behavior from other 'wait for' pods functions in that it requests the list of pods on every iteration. This is useful, for example, in cluster startup, because the number of pods increases while waiting. All pods that are in SUCCESS state are not counted.

If ignoreLabels is not empty, pods matching this selector are ignored.

If minPods or allowedNotReadyPods are -1, this method returns immediately without waiting.

func WaitTimeoutForPodReadyInNamespace

func WaitTimeoutForPodReadyInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodReadyInNamespace waits the given timeout duration for the specified pod to be ready and running.

func WaitTimeoutForPodRunningInNamespace

func WaitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodRunningInNamespace waits the given timeout duration for the specified pod to become running.

Types

This section is empty.

Jump to

Keyboard shortcuts

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