utils

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 16 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 AaqControllerReady added in v1.1.6

func AaqControllerReady(clientset *kubernetes.Clientset, aaqInstallNs string) (bool, error)

func AddLabelToNamespace added in v1.1.6

func AddLabelToNamespace(clientset *kubernetes.Clientset, namespace, key, value string) error

AddLabelToNamespace adds a label to the specified namespace

func CreateApplicationAwareClusterResourceQuota added in v1.1.6

func CreateApplicationAwareClusterResourceQuota(ctx context.Context, c *aaqclientset.Clientset, ApplicationAwareClusterResourceQuota *v1alpha1.ApplicationAwareClusterResourceQuota) (*v1alpha1.ApplicationAwareClusterResourceQuota, error)

CreateApplicationAwareClusterResourceQuota in the specified namespace

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 DeleteApplicationAwareClusterResourceQuota added in v1.1.6

func DeleteApplicationAwareClusterResourceQuota(ctx context.Context, c *aaqclientset.Clientset, name string) error

DeleteApplicationAwareClusterResourceQuota with the specified name

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 NewTestPodForQuota added in v1.1.6

func NewTestPodForQuota(name string, requests v1.ResourceList, limits v1.ResourceList) *v1.Pod

newTestPodForQuota returns a pod that has the specified requests and limits

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 RemoveLabelFromNamespace added in v1.1.6

func RemoveLabelFromNamespace(clientset *kubernetes.Clientset, namespace, key string) error

RemoveLabelFromNamespace removes a label from the specified namespace

func VerifyPodIsGated added in v1.1.6

func VerifyPodIsGated(c kubernetes.Interface, podNamespace, podName string)

func VerifyPodIsNotGated added in v1.1.6

func VerifyPodIsNotGated(c kubernetes.Interface, podNamespace, podName string)

func WaitForApplicationAwareClusterResourceQuota added in v1.1.6

func WaitForApplicationAwareClusterResourceQuota(ctx context.Context, c *aaqclientset.Clientset, quotaName string, used v1.ResourceList) error

wait for Application Aware Cluster Resource Quota status to show the expected used resources value

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