const LabelLogOnPodFailure … // TODO: Move to its own subpkg. // expectNoError checks if "err" is set, and if so, fails assertion while logging the error. func expectNoError(err error, explain ...interface{ … } // TODO: Move to its own subpkg. // expectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller // (for example, for call chain f -> g -> expectNoErrorWithOffset(1, ...) error would be logged for "f"). func expectNoErrorWithOffset(offset int, err error, explain ...interface{ … } // PodsCreated returns a pod list matched by the given name. func PodsCreated(ctx context.Context, c clientset.Interface, ns, name string, replicas int32) (*v1.PodList, error) { … } // PodsCreatedByLabel returns a created pod list matched by the given label. func PodsCreatedByLabel(ctx context.Context, c clientset.Interface, ns, name string, replicas int32, label labels.Selector) (*v1.PodList, error) { … } // VerifyPods checks if the specified pod is responding. func VerifyPods(ctx context.Context, c clientset.Interface, ns, name string, wantName bool, replicas int32) error { … } // VerifyPodsRunning checks if the specified pod is running. func VerifyPodsRunning(ctx context.Context, c clientset.Interface, ns, name string, wantName bool, replicas int32) error { … } func podRunningMaybeResponding(ctx context.Context, c clientset.Interface, ns, name string, wantName bool, replicas int32, checkResponding bool) error { … } func podsRunning(ctx context.Context, c clientset.Interface, pods *v1.PodList) []error { … } // LogPodStates logs basic info of provided pods for debugging. func LogPodStates(pods []v1.Pod) { … } // logPodTerminationMessages logs termination messages for failing pods. It's a short snippet (much smaller than full logs), but it often shows // why pods crashed and since it is in the API, it's fast to retrieve. func logPodTerminationMessages(pods []v1.Pod) { … } // logPodLogs logs the container logs from pods in the given namespace. This can be helpful for debugging // issues that do not cause the container to fail (e.g.: network connectivity issues) // We will log the Pods that have the LabelLogOnPodFailure label. If there aren't any, we default to // logging only the first 5 Pods. This requires the reportDir to be set, and the pods are logged into: // {report_dir}/pods/{namespace}/{pod}/{container_name}/logs.txt func logPodLogs(ctx context.Context, c clientset.Interface, namespace string, pods []v1.Pod, reportDir string) { … } // DumpAllPodInfoForNamespace logs all pod information for a given namespace. func DumpAllPodInfoForNamespace(ctx context.Context, c clientset.Interface, namespace, reportDir string) { … } // FilterNonRestartablePods filters out pods that will never get recreated if // deleted after termination. func FilterNonRestartablePods(pods []*v1.Pod) []*v1.Pod { … } func isNotRestartAlwaysMirrorPod(p *v1.Pod) bool { … } // NewAgnhostPod returns a pod that uses the agnhost image. The image's binary supports various subcommands // that behave the same, no matter the underlying OS. If no args are given, it defaults to the pause subcommand. // For more information about agnhost subcommands, see: https://github.com/kubernetes/kubernetes/tree/master/test/images/agnhost#agnhost func NewAgnhostPod(ns, podName string, volumes []v1.Volume, mounts []v1.VolumeMount, ports []v1.ContainerPort, args ...string) *v1.Pod { … } func NewAgnhostPodFromContainers(ns, podName string, volumes []v1.Volume, containers ...v1.Container) *v1.Pod { … } // NewAgnhostContainer returns the container Spec of an agnhost container. func NewAgnhostContainer(containerName string, mounts []v1.VolumeMount, ports []v1.ContainerPort, args ...string) v1.Container { … } // NewExecPodSpec returns the pod spec of hostexec pod func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod { … } // newExecPodSpec returns the pod spec of exec pod func newExecPodSpec(ns, generateName string) *v1.Pod { … } // CreateExecPodOrFail creates a agnhost pause pod used as a vessel for kubectl exec commands. // Pod name is uniquely generated. func CreateExecPodOrFail(ctx context.Context, client clientset.Interface, ns, generateName string, tweak func(*v1.Pod)) *v1.Pod { … } // WithWindowsHostProcess sets the Pod's Windows HostProcess option to true. When this option is set, // HostNetwork can be enabled. // Containers running as HostProcess will require certain usernames to be set, otherwise the Pod will // not start: NT AUTHORITY\SYSTEM, NT AUTHORITY\Local service, NT AUTHORITY\NetworkService. // If the given username is empty, NT AUTHORITY\SYSTEM will be used instead. // See: https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/ func WithWindowsHostProcess(pod *v1.Pod, username string) { … } // CheckPodsRunningReady returns whether all pods whose names are listed in // podNames in namespace ns are running and ready, using c and waiting at most // timeout. func CheckPodsRunningReady(ctx context.Context, c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool { … } // CheckPodsRunningReadyOrSucceeded returns whether all pods whose names are // listed in podNames in namespace ns are running and ready, or succeeded; use // c and waiting at most timeout. func CheckPodsRunningReadyOrSucceeded(ctx context.Context, c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool { … } // checkPodsCondition returns whether all pods whose names are listed in podNames // in namespace ns are in the condition, using c and waiting at most timeout. func checkPodsCondition(ctx context.Context, c clientset.Interface, ns string, podNames []string, timeout time.Duration, condition podCondition, desc string) bool { … } // GetPodLogs returns the logs of the specified container (namespace/pod/container). func GetPodLogs(ctx context.Context, c clientset.Interface, namespace, podName, containerName string) (string, error) { … } // GetPodLogsSince returns the logs of the specified container (namespace/pod/container) since a timestamp. func GetPodLogsSince(ctx context.Context, c clientset.Interface, namespace, podName, containerName string, since time.Time) (string, error) { … } // GetPreviousPodLogs returns the logs of the previous instance of the // specified container (namespace/pod/container). func GetPreviousPodLogs(ctx context.Context, c clientset.Interface, namespace, podName, containerName string) (string, error) { … } // utility function for gomega Eventually func getPodLogsInternal(ctx context.Context, c clientset.Interface, namespace, podName, containerName string, previous bool, sinceTime *metav1.Time, tailLines *int) (string, error) { … } // GetPodsInNamespace returns the pods in the given namespace. func GetPodsInNamespace(ctx context.Context, c clientset.Interface, ns string, ignoreLabels map[string]string) ([]*v1.Pod, error) { … } // GetPods return the label matched pods in the given ns func GetPods(ctx context.Context, c clientset.Interface, ns string, matchLabels map[string]string) ([]v1.Pod, error) { … } // GetPodSecretUpdateTimeout returns the timeout duration for updating pod secret. func GetPodSecretUpdateTimeout(ctx context.Context, c clientset.Interface) time.Duration { … } // VerifyPodHasConditionWithType verifies the pod has the expected condition by type func VerifyPodHasConditionWithType(ctx context.Context, f *framework.Framework, pod *v1.Pod, cType v1.PodConditionType) { … } func getNodeTTLAnnotationValue(ctx context.Context, c clientset.Interface) (time.Duration, error) { … } // FilterActivePods returns pods that have not terminated. func FilterActivePods(pods []*v1.Pod) []*v1.Pod { … } // IsPodActive return true if the pod meets certain conditions. func IsPodActive(p *v1.Pod) bool { … }