Documentation ¶
Index ¶
- Constants
- func DumpAllPodInfoForNamespace(c clientset.Interface, namespace, reportDir string)
- func GetPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)
- func GetPreviousPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)
- func LogPodStates(pods []v1.Pod)
- func PodRunningReady(p *v1.Pod) (bool, error)
- func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, ...) error
- func WaitForPodNotFoundInNamespace(c clientset.Interface, podName, ns string, timeout time.Duration) error
- func WaitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName, namespace string, timeout time.Duration) error
- func WaitForPodTerminatedInNamespace(c clientset.Interface, podName, reason, namespace string) error
- func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labels.Selector, ...) error
- func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedNotReadyPods int32, ...) error
- func WaitTimeoutForPodReadyInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error
- func WaitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error
Constants ¶
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 ¶
DumpAllPodInfoForNamespace logs all pod information for a given namespace.
func GetPodLogs ¶
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 ¶
LogPodStates logs basic info of provided pods for debugging.
func PodRunningReady ¶
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.
Types ¶
This section is empty.