utils

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PodWaitForTime is the time to wait for Pod operations to complete
	PodWaitForTime = defaultPollPeriod
	// PodWaitForTimeFast is the fast time to wait for Pod operations to complete (30 sec)
	PodWaitForTimeFast = defaultPollPeriodFast
	// PodWaitIntervalFast is the fast polling interval (250ms)
	PodWaitIntervalFast = 250 * time.Millisecond

	//VerifierPodName is the name of the verifier pod.
	VerifierPodName = "verifier"
)

Variables

This section is empty.

Functions

func CreatePod

func CreatePod(clientSet *kubernetes.Clientset, namespace string, podDef *k8sv1.Pod) (*k8sv1.Pod, error)

CreatePod calls the Kubernetes API to create a Pod

func DeletePod

func DeletePod(clientSet *kubernetes.Clientset, pod *k8sv1.Pod, namespace string) error

DeletePod deletes the passed in Pod from the passed in Namespace

func DeletePodByName

func DeletePodByName(clientSet *kubernetes.Clientset, podName, namespace string, gracePeriod *int64) error

DeletePodByName deletes the pod based on the passed in name from the passed in Namespace

func DeletePodNoGrace

func DeletePodNoGrace(clientSet *kubernetes.Clientset, pod *k8sv1.Pod, namespace string) error

DeletePodNoGrace deletes the passed in Pod from the passed in Namespace

func DeleteVerifierPod

func DeleteVerifierPod(clientSet *kubernetes.Clientset, namespace string) error

DeleteVerifierPod deletes the verifier pod

func FindPodByPrefix

func FindPodByPrefix(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)

FindPodByPrefix finds the first pod which has the passed in prefix. Returns error if multiple pods with the same prefix are found.

func FindPodByPrefixOnce

func FindPodByPrefixOnce(clientSet *kubernetes.Clientset, namespace, prefix, labelSelector string) (*k8sv1.Pod, error)

FindPodByPrefixOnce finds once (no polling) the first pod which has the passed in prefix. Returns error if multiple pods with the same prefix are found.

func FindPodBySuffix

func FindPodBySuffix(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)

FindPodBySuffix finds the first pod which has the passed in suffix. Returns error if multiple pods with the same suffix are found.

func FindPodBySuffixOnce

func FindPodBySuffixOnce(clientSet *kubernetes.Clientset, namespace, suffix, labelSelector string) (*k8sv1.Pod, error)

FindPodBySuffixOnce finds once (no polling) the first pod which has the passed in suffix. Returns error if multiple pods with the same suffix are found.

func GetAAQ

func GetAAQ(f *framework.Framework) (*aaqv1.AAQ, error)

func GetLeader

func GetLeader(virtClient *kubernetes.Clientset, aaqNS string) string

func GetPodCondition

func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodConditionFromList

func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)

GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.

func GetSchedulableNode

func GetSchedulableNode(nodes *v1.NodeList) *string

GetSchedulableNode return a schedulable node from a nodes list

func IsExpectedNode

func IsExpectedNode(clientSet *kubernetes.Clientset, nodeName, podName, namespace string, timeout time.Duration) error

IsExpectedNode waits to check if the specified pod is schedule on the specified node

func IsOpenshift

func IsOpenshift(client kubernetes.Interface) bool

IsOpenshift checks if we are on OpenShift platform

func PodGetNode

func PodGetNode(clientSet *kubernetes.Clientset, podName, namespace string) (string, error)

PodGetNode returns the node on which a given pod is executing

func PodSchedulingGated

func PodSchedulingGated(c kubernetes.Interface, podNamespace, podName string) bool

PodSchedulingGated returns a condition function that returns true if the given pod gets unschedulable status of reason 'SchedulingGated'.

func WaitPodDeleted

func WaitPodDeleted(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) (bool, error)

WaitPodDeleted waits fo a pod to no longer exist returns whether the pod is deleted along with any error

func WaitTimeoutForPodCondition

func WaitTimeoutForPodCondition(clientSet *kubernetes.Clientset, podName, namespace string, conditionType k8sv1.PodConditionType, pollperiod, timeout time.Duration) error

WaitTimeoutForPodCondition waits for the given pod to be created and have an expected condition

func WaitTimeoutForPodFailed

func WaitTimeoutForPodFailed(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodFailed waits for pod to fail

func WaitTimeoutForPodReady

func WaitTimeoutForPodReady(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodReady waits for the given pod to be created and ready

func WaitTimeoutForPodReadyPollPeriod

func WaitTimeoutForPodReadyPollPeriod(clientSet *kubernetes.Clientset, podName, namespace string, pollperiod, timeout time.Duration) error

WaitTimeoutForPodReadyPollPeriod waits for the given pod to be created and ready using the passed in poll period

func WaitTimeoutForPodStatus

func WaitTimeoutForPodStatus(clientSet *kubernetes.Clientset, podName, namespace string, status k8sv1.PodPhase, timeout time.Duration) error

WaitTimeoutForPodStatus waits for the given pod to be created and have a expected status

func WaitTimeoutForPodSucceeded

func WaitTimeoutForPodSucceeded(clientSet *kubernetes.Clientset, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodSucceeded waits for pod to succeed

Types

This section is empty.

Jump to

Keyboard shortcuts

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