Documentation
¶
Index ¶
- Constants
- Variables
- func CheckPodsRunningReady(c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool
- func CheckPodsRunningReadyOrSucceeded(c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool
- func CountRemainingPods(c clientset.Interface, namespace string) (int, int, error)
- func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)
- func CreateExecPodOrFail(client clientset.Interface, ns, generateName string, tweak func(*v1.Pod)) *v1.Pod
- func CreatePod(client clientset.Interface, namespace string, nodeSelector map[string]string, ...) (*v1.Pod, error)
- func CreatePodOrFail(c clientset.Interface, ns, name string, labels map[string]string, ...)
- func CreateSecPod(client clientset.Interface, namespace string, ...) (*v1.Pod, error)
- func CreateSecPodWithNodeSelection(client clientset.Interface, namespace string, ...) (*v1.Pod, error)
- func CreateUnschedulablePod(client clientset.Interface, namespace string, nodeSelector map[string]string, ...) (*v1.Pod, error)
- func CreateWaitAndDeletePod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim, ...) (err error)
- func DeletePodOrFail(c clientset.Interface, ns, name string)
- func DeletePodWithWait(c clientset.Interface, pod *v1.Pod) error
- func DeletePodWithWaitByName(c clientset.Interface, podName, podNamespace string) error
- func DumpAllPodInfo(c clientset.Interface)
- func DumpAllPodInfoForNamespace(c clientset.Interface, namespace string)
- func FilterNonRestartablePods(pods []*v1.Pod) []*v1.Pod
- func GetPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)
- func GetPodsInNamespace(c clientset.Interface, ns string, ignoreLabels map[string]string) ([]*v1.Pod, error)
- func GetPodsScheduled(masterNodes sets.String, pods *v1.PodList) (scheduledPods, notScheduledPods []v1.Pod)
- func GetPreviousPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)
- func LogPodStates(pods []v1.Pod)
- func MakePod(ns string, nodeSelector map[string]string, ...) *v1.Pod
- func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, ...) *v1.Pod
- func NewExecPodSpec(ns, name string, hostNetwork bool) *v1.Pod
- func PatchContainerImages(containers []v1.Container) error
- func PodsCreated(c clientset.Interface, ns, name string, replicas int32) (*v1.PodList, error)
- func PodsCreatedByLabel(c clientset.Interface, ns, name string, replicas int32, label labels.Selector) (*v1.PodList, error)
- func PodsResponding(c clientset.Interface, ns, name string, wantName bool, pods *v1.PodList) error
- func SetAffinity(nodeSelection *NodeSelection, nodeName string)
- func SetAntiAffinity(nodeSelection *NodeSelection, nodeName string)
- func VerifyPods(c clientset.Interface, ns, name string, wantName bool, replicas int32) error
- func VerifyPodsRunning(c clientset.Interface, ns, name string, wantName bool, replicas int32) error
- func WaitForControlledPods(c clientset.Interface, ns, name string, kind schema.GroupKind) (pods *v1.PodList, err error)
- func WaitForControlledPodsRunning(c clientset.Interface, ns, name string, kind schema.GroupKind) error
- func WaitForMatchPodsCondition(c clientset.Interface, opts metav1.ListOptions, desc string, ...) error
- func WaitForNRestartablePods(ps *testutils.PodStore, expect int, timeout time.Duration) ([]string, error)
- func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, ...) error
- func WaitForPodNameRunningInNamespace(c clientset.Interface, podName, namespace string) error
- func WaitForPodNameUnschedulableInNamespace(c clientset.Interface, podName, namespace string) error
- func WaitForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace string) error
- func WaitForPodNotFoundInNamespace(c clientset.Interface, podName, ns string, timeout time.Duration) error
- func WaitForPodNotPending(c clientset.Interface, ns, podName string) error
- func WaitForPodRunningInNamespace(c clientset.Interface, pod *v1.Pod) error
- func WaitForPodRunningInNamespaceSlow(c clientset.Interface, podName, namespace string) error
- func WaitForPodSuccessInNamespace(c clientset.Interface, podName string, namespace string) error
- func WaitForPodSuccessInNamespaceSlow(c clientset.Interface, podName string, namespace string) error
- func WaitForPodTerminatedInNamespace(c clientset.Interface, podName, reason, namespace string) error
- func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labels.Selector, ...) error
- func WaitForPodsGone(ps *testutils.PodStore, interval, timeout time.Duration) error
- func WaitForPodsInactive(ps *testutils.PodStore, interval, timeout time.Duration) error
- func WaitForPodsReady(c clientset.Interface, ns, name string, minReadySeconds int) error
- func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedNotReadyPods int32, ...) error
- func WaitForPodsWithLabel(c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error)
- func WaitForPodsWithLabelRunningReady(c clientset.Interface, ns string, label labels.Selector, num int, ...) (pods *v1.PodList, err error)
- func WaitForPodsWithLabelScheduled(c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error)
- func WaitTimeoutForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) 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
- type NodeSelection
- type ProxyResponseChecker
Constants ¶
const ( // PodDeleteTimeout is how long to wait for a pod to be deleted. PodDeleteTimeout = 5 * time.Minute )
Variables ¶
var ( // BusyBoxImage is the image URI of BusyBox. BusyBoxImage = imageutils.GetE2EImage(imageutils.BusyBox) )
Functions ¶
func CheckPodsRunningReady ¶
func CheckPodsRunningReady(c clientset.Interface, ns string, podNames []string, timeout time.Duration) bool
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 CheckPodsRunningReadyOrSucceeded ¶
func CheckPodsRunningReadyOrSucceeded(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 CountRemainingPods ¶
CountRemainingPods queries the server to count number of remaining pods, and number of pods that had a missing deletion timestamp.
func CreateClientPod ¶
func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)
CreateClientPod defines and creates a pod with a mounted PV. Pod runs infinite loop until killed.
func CreateExecPodOrFail ¶
func CreateExecPodOrFail(client clientset.Interface, ns, generateName string, tweak func(*v1.Pod)) *v1.Pod
CreateExecPodOrFail creates a agnhost pause pod used as a vessel for kubectl exec commands. Pod name is uniquely generated.
func CreatePod ¶
func CreatePod(client clientset.Interface, namespace string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) (*v1.Pod, error)
CreatePod with given claims based on node selector
func CreatePodOrFail ¶
func CreatePodOrFail(c clientset.Interface, ns, name string, labels map[string]string, containerPorts []v1.ContainerPort)
CreatePodOrFail creates a pod with the specified containerPorts.
func CreateSecPod ¶
func CreateSecPod(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64, timeout time.Duration) (*v1.Pod, error)
CreateSecPod creates security pod with given claims
func CreateSecPodWithNodeSelection ¶
func CreateSecPodWithNodeSelection(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64, node NodeSelection, timeout time.Duration) (*v1.Pod, error)
CreateSecPodWithNodeSelection creates security pod with given claims
func CreateUnschedulablePod ¶
func CreateUnschedulablePod(client clientset.Interface, namespace string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) (*v1.Pod, error)
CreateUnschedulablePod with given claims based on node selector
func CreateWaitAndDeletePod ¶
func CreateWaitAndDeletePod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim, command string) (err error)
CreateWaitAndDeletePod creates the test pod, wait for (hopefully) success, and then delete the pod. Note: need named return value so that the err assignment in the defer sets the returned error.
Has been shown to be necessary using Go 1.7.
func DeletePodOrFail ¶
DeletePodOrFail deletes the pod of the specified namespace and name.
func DeletePodWithWait ¶
DeletePodWithWait deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod not existing.
func DeletePodWithWaitByName ¶
DeletePodWithWaitByName deletes the named and namespaced pod and waits for the pod to be terminated. Resilient to the pod not existing.
func DumpAllPodInfo ¶
DumpAllPodInfo logs basic info for all pods.
func DumpAllPodInfoForNamespace ¶
DumpAllPodInfoForNamespace logs all pod information for a given namespace.
func FilterNonRestartablePods ¶
FilterNonRestartablePods filters out pods that will never get recreated if deleted after termination.
func GetPodLogs ¶
GetPodLogs returns the logs of the specified container (namespace/pod/container). TODO(random-liu): Change this to be a member function of the framework.
func GetPodsInNamespace ¶
func GetPodsInNamespace(c clientset.Interface, ns string, ignoreLabels map[string]string) ([]*v1.Pod, error)
GetPodsInNamespace returns the pods in the given namespace.
func GetPodsScheduled ¶
func GetPodsScheduled(masterNodes sets.String, pods *v1.PodList) (scheduledPods, notScheduledPods []v1.Pod)
GetPodsScheduled returns a number of currently scheduled and not scheduled Pods.
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 MakePod ¶
func MakePod(ns string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *v1.Pod
MakePod returns a pod definition based on the namespace. The pod references the PVC's name. A slice of BASH commands can be supplied as args to be run by the pod
func MakeSecPod ¶
func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64) *v1.Pod
MakeSecPod returns a pod definition based on the namespace. The pod references the PVC's name. A slice of BASH commands can be supplied as args to be run by the pod. SELinux testing requires to pass HostIPC and HostPID as booleansi arguments.
func NewExecPodSpec ¶
NewExecPodSpec returns the pod spec of hostexec pod
func PatchContainerImages ¶
PatchContainerImages replaces the specified Container Registry with a custom one provided via the KUBE_TEST_REPO_LIST env variable
func PodsCreated ¶
PodsCreated returns a pod list matched by the given name.
func PodsCreatedByLabel ¶
func PodsCreatedByLabel(c clientset.Interface, ns, name string, replicas int32, label labels.Selector) (*v1.PodList, error)
PodsCreatedByLabel returns a created pod list matched by the given label.
func PodsResponding ¶
PodsResponding waits for the pods to response.
func SetAffinity ¶
func SetAffinity(nodeSelection *NodeSelection, nodeName string)
SetAffinity sets affinity to nodeName to nodeSelection
func SetAntiAffinity ¶
func SetAntiAffinity(nodeSelection *NodeSelection, nodeName string)
SetAntiAffinity sets anti-affinity to nodeName to nodeSelection
func VerifyPods ¶
VerifyPods checks if the specified pod is responding.
func VerifyPodsRunning ¶
VerifyPodsRunning checks if the specified pod is running.
func WaitForControlledPods ¶
func WaitForControlledPods(c clientset.Interface, ns, name string, kind schema.GroupKind) (pods *v1.PodList, err error)
WaitForControlledPods waits up to podListTimeout for getting pods of the specified controller name and return them.
func WaitForControlledPodsRunning ¶
func WaitForControlledPodsRunning(c clientset.Interface, ns, name string, kind schema.GroupKind) error
WaitForControlledPodsRunning waits up to 10 minutes for pods to become Running.
func WaitForMatchPodsCondition ¶
func WaitForMatchPodsCondition(c clientset.Interface, opts metav1.ListOptions, desc string, timeout time.Duration, condition podCondition) error
WaitForMatchPodsCondition finds match pods based on the input ListOptions. waits and checks if all match pods are in the given podCondition
func WaitForNRestartablePods ¶
func WaitForNRestartablePods(ps *testutils.PodStore, expect int, timeout time.Duration) ([]string, error)
WaitForNRestartablePods tries to list restarting pods using ps until it finds expect of them, returning their names if it can do so before timeout.
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 WaitForPodNameRunningInNamespace ¶
WaitForPodNameRunningInNamespace waits default amount of time (PodStartTimeout) for the specified pod to become running. Returns an error if timeout occurs first, or pod goes in to failed state.
func WaitForPodNameUnschedulableInNamespace ¶
WaitForPodNameUnschedulableInNamespace returns an error if it takes too long for the pod to become Pending and have condition Status equal to Unschedulable, if the pod Get api returns an error (IsNotFound or other), or if the pod failed with an unexpected reason. Typically called to test that the passed-in pod is Pending and Unschedulable.
func WaitForPodNoLongerRunningInNamespace ¶
WaitForPodNoLongerRunningInNamespace waits default amount of time (defaultPodDeletionTimeout) for the specified pod to stop running. Returns an error if timeout occurs first.
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 WaitForPodNotPending ¶
WaitForPodNotPending returns an error if it took too long for the pod to go out of pending state. The resourceVersion is used when Watching object changes, it tells since when we care about changes to the pod.
func WaitForPodRunningInNamespace ¶
WaitForPodRunningInNamespace waits default amount of time (podStartTimeout) for the specified pod to become running. Returns an error if timeout occurs first, or pod goes in to failed state.
func WaitForPodRunningInNamespaceSlow ¶
WaitForPodRunningInNamespaceSlow waits an extended amount of time (slowPodStartTimeout) for the specified pod to become running. The resourceVersion is used when Watching object changes, it tells since when we care about changes to the pod. Returns an error if timeout occurs first, or pod goes in to failed state.
func WaitForPodSuccessInNamespace ¶
WaitForPodSuccessInNamespace returns nil if the pod reached state success, or an error if it reached failure or until podStartupTimeout.
func WaitForPodSuccessInNamespaceSlow ¶
func WaitForPodSuccessInNamespaceSlow(c clientset.Interface, podName string, namespace string) error
WaitForPodSuccessInNamespaceSlow returns nil if the pod reached state success, or an error if it reached failure or until slowPodStartupTimeout.
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 WaitForPodsGone ¶
WaitForPodsGone waits until there are no pods left in the PodStore.
func WaitForPodsInactive ¶
WaitForPodsInactive waits until there are no active pods left in the PodStore. This is to make a fair comparison of deletion time between DeleteRCAndPods and DeleteRCAndWaitForGC, because the RC controller decreases status.replicas when the pod is inactvie.
func WaitForPodsReady ¶
WaitForPodsReady waits for the pods to become ready.
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.
func WaitForPodsWithLabel ¶
func WaitForPodsWithLabel(c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error)
WaitForPodsWithLabel waits up to podListTimeout for getting pods with certain label
func WaitForPodsWithLabelRunningReady ¶
func WaitForPodsWithLabelRunningReady(c clientset.Interface, ns string, label labels.Selector, num int, timeout time.Duration) (pods *v1.PodList, err error)
WaitForPodsWithLabelRunningReady waits for exact amount of matching pods to become running and ready. Return the list of matching pods.
func WaitForPodsWithLabelScheduled ¶
func WaitForPodsWithLabelScheduled(c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error)
WaitForPodsWithLabelScheduled waits for all matching pods to become scheduled and at least one matching pod exists. Return the list of matching pods.
func WaitTimeoutForPodNoLongerRunningInNamespace ¶
func WaitTimeoutForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error
WaitTimeoutForPodNoLongerRunningInNamespace waits the given timeout duration for the specified pod to stop.
Types ¶
type NodeSelection ¶
NodeSelection specifies where to run a pod, using a combination of fixed node name, node selector and/or affinity.
type ProxyResponseChecker ¶
type ProxyResponseChecker struct {
// contains filtered or unexported fields
}
ProxyResponseChecker is a context for checking pods responses by issuing GETs to them (via the API proxy) and verifying that they answer with their own pod name.
func NewProxyResponseChecker ¶
func NewProxyResponseChecker(c clientset.Interface, ns string, label labels.Selector, controllerName string, respondName bool, pods *v1.PodList) ProxyResponseChecker
NewProxyResponseChecker returns a context for checking pods responses.
func (ProxyResponseChecker) CheckAllResponses ¶
func (r ProxyResponseChecker) CheckAllResponses() (done bool, err error)
CheckAllResponses issues GETs to all pods in the context and verify they reply with their own pod name.