Documentation
¶
Index ¶
- Constants
- func AddLabelAndPatch(ctx context.Context, kubeClient *kubernetes.Clientset, ...) error
- func CleanUpJob(ctx context.Context, kubeClient *kubernetes.Clientset, namespace, name string)
- func CleanUpKueueInstance(ctx context.Context, kueueClientset *kueueclient.Clientset, name string, ...)
- func CleanUpObject(ctx context.Context, kubeClient client.Client, obj client.Object)
- func CleanUpWorkload(ctx context.Context, kueueClient *upstreamkueueclient.Clientset, ...)
- func CreateClusterQueue(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
- func CreateJob(kubeClient *kubernetes.Clientset, job *batchv1.Job) (func(), error)
- func CreateLocalQueue(ctx context.Context, client *upstreamkueueclient.Clientset, ...) (func(), error)
- func CreateNamespace(kubeClient *kubernetes.Clientset, namespace *corev1.Namespace) (func(), error)
- func CreatePod(kubeClient *kubernetes.Clientset, pod *corev1.Pod) (func(), error)
- func CreateResourceFlavor(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
- func CreateWorkload(client *upstreamkueueclient.Clientset, ...) (func(), error)
- func DumpKueueControllerManagerLogs(ctx context.Context, kubeClient *kubernetes.Clientset, tailLines int64)
- func GetContainerImageForWorkloads() string
- func GetVisibilityClientV1beta2(user string) (visibilityv1beta2.VisibilityV1beta2Interface, error)
- func IsDRASupported(kubeClient *kubernetes.Clientset) bool
- func IsHyperShiftCluster(configClient *configclientv1.ConfigV1Client) (bool, error)
- func IsJobPodRunning(ctx context.Context, kubeClient *kubernetes.Clientset, ...) bool
- func IsJobSetRunning(ctx context.Context, genericClient client.Client, jobSet *jobsetapi.JobSet) (bool, error)
- func IsJobSuspended(ctx context.Context, kubeClient *kubernetes.Clientset, ...) bool
- func IsPodScheduled(ctx context.Context, kubeClient *kubernetes.Clientset, ...) bool
- func NewResourceClaimTemplate(name, namespace, deviceClass string, count int64, celExpression string) *resourcev1.ResourceClaimTemplate
- func SetupTestEnv(ctx context.Context, kubeClient *kubernetes.Clientset, ...) (*kueuev1beta2.ClusterQueue, *corev1.Namespace)
- func WaitForAllPodsInNamespaceDeleted(ctx context.Context, c client.Client, ns *corev1.Namespace)
- type ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
- func (cqw *ClusterQueueWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.ClusterQueue, func(), error)
- func (cqw *ClusterQueueWrapper) WithAdmissionScope(mode kueuev1beta2.AdmissionMode) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithBorrowingLimit(resourceName corev1.ResourceName, limit string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithCPU(cpu string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithCohort(cohort string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithDRAResource(name, quota string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithFlavorName(flavorName string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithGenerateName() *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithMemory(memory string) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithPreemption(withinClusterQueue kueuev1beta2.PreemptionPolicy) *ClusterQueueWrapper
- func (cqw *ClusterQueueWrapper) WithReclaimWithinCohort(policy kueuev1beta2.PreemptionPolicy) *ClusterQueueWrapper
- type KueueWrapper
- type LeaderWorkerSetOptions
- type LocalQueueWrapper
- func (lqw *LocalQueueWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
- func (lqw *LocalQueueWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.LocalQueue, func(), error)
- func (lqw *LocalQueueWrapper) WithClusterQueue(clusterQueue string) *LocalQueueWrapper
- func (lqw *LocalQueueWrapper) WithFairSharingWeight(weight string) *LocalQueueWrapper
- func (lqw *LocalQueueWrapper) WithGenerateName() *LocalQueueWrapper
- type PodWrapper
- type ResourceFlavorWrapper
- func (rfw *ResourceFlavorWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
- func (rfw *ResourceFlavorWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.ResourceFlavor, func(), error)
- func (rfw *ResourceFlavorWrapper) WithGenerateName() *ResourceFlavorWrapper
- func (rfw *ResourceFlavorWrapper) WithNodeLabel(key, value string) *ResourceFlavorWrapper
- func (rfw *ResourceFlavorWrapper) WithTopologyName(name string) *ResourceFlavorWrapper
- type TestClients
- type TestResourceBuilder
- func (b *TestResourceBuilder) NewDRAExtendedResourceJob(name, queueName, extendedResource string, count int) *batchv1.Job
- func (b *TestResourceBuilder) NewDRAJob(name, queueName, templateName string) *batchv1.Job
- func (b *TestResourceBuilder) NewDeployment() *appsv1.Deployment
- func (b *TestResourceBuilder) NewDeploymentWithoutQueue() *appsv1.Deployment
- func (b *TestResourceBuilder) NewJob() *batchv1.Job
- func (b *TestResourceBuilder) NewJobSet() *jobsetapi.JobSet
- func (b *TestResourceBuilder) NewJobSetWithoutQueue() *jobsetapi.JobSet
- func (b *TestResourceBuilder) NewJobWithoutQueue() *batchv1.Job
- func (b *TestResourceBuilder) NewLeaderWorkerSet(opts LeaderWorkerSetOptions) *lwsapi.LeaderWorkerSet
- func (b *TestResourceBuilder) NewPod() *corev1.Pod
- func (b *TestResourceBuilder) NewPodWithoutQueue() *corev1.Pod
- func (b *TestResourceBuilder) NewStatefulSet() *appsv1.StatefulSet
- func (b *TestResourceBuilder) NewStatefulSetWithoutQueue() *appsv1.StatefulSet
- type TopologyWrapper
Constants ¶
const ( OperatorReadyTime = 6 * time.Minute OperatorPoll = 10 * time.Second OperatorNamespace = "openshift-kueue-operator" OpenShiftManagedLabel = "kueue.openshift.io/managed" QueueLabel = "kueue.x-k8s.io/queue-name" DefaultLocalQueueName = "default" DeletionTime = 3 * time.Minute DeletionPoll = 5 * time.Second ConsistentlyTimeout = 5 * time.Second ConsistentlyPoll = 1 * time.Second ConsistentlyLongTimeout = 15 * time.Second ConsistentlyLongPoll = 5 * time.Second DeviceClassKind = "DeviceClass" )
Variables ¶
This section is empty.
Functions ¶
func AddLabelAndPatch ¶
func CleanUpJob ¶
func CleanUpJob(ctx context.Context, kubeClient *kubernetes.Clientset, namespace, name string)
CleanUpJob deletes the specified Job in the given namespace.
func CleanUpKueueInstance ¶
func CleanUpKueueInstance(ctx context.Context, kueueClientset *kueueclient.Clientset, name string, kubeClient *kubernetes.Clientset)
CleanUpKueueInstance deletes the specified Kueue instance and waits for its removal. It also waits for webhook endpointslices to be completely gone if kubeClient is provided.
func CleanUpObject ¶
CleanUpObject deletes the specified kubernetes object and waits for its removal.
func CleanUpWorkload ¶
func CleanUpWorkload(ctx context.Context, kueueClient *upstreamkueueclient.Clientset, namespace, name string)
CleanUpWorkload deletes the specified Kueue Workload in the given namespace.
func CreateClusterQueue ¶
func CreateClusterQueue(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
func CreateLocalQueue ¶
func CreateNamespace ¶
func CreateNamespace(kubeClient *kubernetes.Clientset, namespace *corev1.Namespace) (func(), error)
func CreateResourceFlavor ¶
func CreateResourceFlavor(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
func CreateWorkload ¶
func CreateWorkload(client *upstreamkueueclient.Clientset, namespace, queueName, workloadName string) (func(), error)
func DumpKueueControllerManagerLogs ¶
func DumpKueueControllerManagerLogs(ctx context.Context, kubeClient *kubernetes.Clientset, tailLines int64)
DumpKueueControllerManagerLogs dumps the logs from kueue-controller-manager pods when a test fails. This should be called from JustAfterEach.
func GetContainerImageForWorkloads ¶
func GetContainerImageForWorkloads() string
func GetVisibilityClientV1beta2 ¶
func GetVisibilityClientV1beta2(user string) (visibilityv1beta2.VisibilityV1beta2Interface, error)
func IsDRASupported ¶
func IsDRASupported(kubeClient *kubernetes.Clientset) bool
IsDRASupported checks if DRA APIs (resource.k8s.io/v1) are available on the cluster.
func IsHyperShiftCluster ¶
func IsHyperShiftCluster(configClient *configclientv1.ConfigV1Client) (bool, error)
IsHyperShiftCluster returns true if the cluster is a HyperShift (Hosted Control Plane) cluster by checking if the Infrastructure CR has controlPlaneTopology set to External.
func IsJobPodRunning ¶
func IsJobPodRunning(ctx context.Context, kubeClient *kubernetes.Clientset, namespace, jobName string) bool
IsJobPodRunning returns true if at least one pod owned by the job is in Running phase.
func IsJobSetRunning ¶
func IsJobSuspended ¶
func IsPodScheduled ¶
func NewResourceClaimTemplate ¶
func NewResourceClaimTemplate(name, namespace, deviceClass string, count int64, celExpression string) *resourcev1.ResourceClaimTemplate
NewResourceClaimTemplate creates a ResourceClaimTemplate for DRA e2e tests. If celExpression is empty, no CEL selector is added.
func SetupTestEnv ¶
func SetupTestEnv(ctx context.Context, kubeClient *kubernetes.Clientset, kueueClient *upstreamkueueclient.Clientset, namespacePrefix, localQueueName string, cqModifiers ...func(*ClusterQueueWrapper)) (*kueuev1beta2.ClusterQueue, *corev1.Namespace)
SetupTestEnv creates a ResourceFlavor, ClusterQueue, Namespace, and LocalQueue for e2e tests. All resources are registered with DeferCleanup. cqModifiers are applied to the ClusterQueueWrapper before creation to configure resources like DRA, preemption, cohorts, etc.
Types ¶
type ClusterQueueWrapper ¶
type ClusterQueueWrapper struct {
*kueuev1beta2.ClusterQueue
}
ClusterQueueWrapper wraps a ClusterQueue and provides builder methods.
func NewClusterQueue ¶
func NewClusterQueue() *ClusterQueueWrapper
NewClusterQueue creates a new wrapper with default values.
func (*ClusterQueueWrapper) Create ¶
func (cqw *ClusterQueueWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
Create creates the ClusterQueue in the cluster and returns cleanup function.
func (*ClusterQueueWrapper) CreateWithObject ¶
func (cqw *ClusterQueueWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.ClusterQueue, func(), error)
CreateWithObject creates the ClusterQueue in the cluster and returns the created object, cleanup function, and error.
func (*ClusterQueueWrapper) WithAdmissionScope ¶
func (cqw *ClusterQueueWrapper) WithAdmissionScope(mode kueuev1beta2.AdmissionMode) *ClusterQueueWrapper
WithAdmissionScope sets the admission scope for the ClusterQueue.
func (*ClusterQueueWrapper) WithBorrowingLimit ¶
func (cqw *ClusterQueueWrapper) WithBorrowingLimit(resourceName corev1.ResourceName, limit string) *ClusterQueueWrapper
WithBorrowingLimit sets the borrowing limit for a specific resource. resourceName is the name of the resource (e.g., "cpu", "memory"). limit is the maximum amount that can be borrowed from the cohort.
func (*ClusterQueueWrapper) WithCPU ¶
func (cqw *ClusterQueueWrapper) WithCPU(cpu string) *ClusterQueueWrapper
WithCPU sets the CPU quota.
func (*ClusterQueueWrapper) WithCohort ¶
func (cqw *ClusterQueueWrapper) WithCohort(cohort string) *ClusterQueueWrapper
WithCohort sets the cohort name for the ClusterQueue.
func (*ClusterQueueWrapper) WithDRAResource ¶
func (cqw *ClusterQueueWrapper) WithDRAResource(name, quota string) *ClusterQueueWrapper
WithDRAResource adds a DRA resource to the first resource group's covered resources and quota.
func (*ClusterQueueWrapper) WithFlavorName ¶
func (cqw *ClusterQueueWrapper) WithFlavorName(flavorName string) *ClusterQueueWrapper
WithFlavorName sets the resource flavor name.
func (*ClusterQueueWrapper) WithGenerateName ¶
func (cqw *ClusterQueueWrapper) WithGenerateName() *ClusterQueueWrapper
WithGenerateName switches to using GenerateName with "cluster-queue-" prefix.
func (*ClusterQueueWrapper) WithMemory ¶
func (cqw *ClusterQueueWrapper) WithMemory(memory string) *ClusterQueueWrapper
WithMemory sets the memory quota.
func (*ClusterQueueWrapper) WithPreemption ¶
func (cqw *ClusterQueueWrapper) WithPreemption(withinClusterQueue kueuev1beta2.PreemptionPolicy) *ClusterQueueWrapper
WithPreemption sets the preemption policy for the ClusterQueue. withinClusterQueue controls preemption within the same ClusterQueue (e.g., "LowerPriority", "Never").
func (*ClusterQueueWrapper) WithReclaimWithinCohort ¶
func (cqw *ClusterQueueWrapper) WithReclaimWithinCohort(policy kueuev1beta2.PreemptionPolicy) *ClusterQueueWrapper
WithReclaimWithinCohort sets the reclaimWithinCohort preemption policy. This controls whether a pending workload can preempt workloads from other ClusterQueues in the cohort.
type KueueWrapper ¶
func NewKueueDefault ¶
func NewKueueDefault() *KueueWrapper
NewKueueDefault returns a default Kueue instance for testing
func (*KueueWrapper) EnableDebug ¶
func (k *KueueWrapper) EnableDebug() *KueueWrapper
func (*KueueWrapper) GetKueue ¶
func (k *KueueWrapper) GetKueue() *ssv1.Kueue
type LeaderWorkerSetOptions ¶
type LocalQueueWrapper ¶
type LocalQueueWrapper struct {
*kueuev1beta2.LocalQueue
}
LocalQueueWrapper wraps a LocalQueue and provides builder methods.
func NewLocalQueue ¶
func NewLocalQueue(namespace, name string) *LocalQueueWrapper
NewLocalQueue creates a new wrapper with default values.
func (*LocalQueueWrapper) Create ¶
func (lqw *LocalQueueWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
Create creates the LocalQueue in the cluster and returns cleanup function.
func (*LocalQueueWrapper) CreateWithObject ¶
func (lqw *LocalQueueWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.LocalQueue, func(), error)
CreateWithObject creates the LocalQueue in the cluster and returns the created object, cleanup function, and error.
func (*LocalQueueWrapper) WithClusterQueue ¶
func (lqw *LocalQueueWrapper) WithClusterQueue(clusterQueue string) *LocalQueueWrapper
WithClusterQueue sets the ClusterQueue name.
func (*LocalQueueWrapper) WithFairSharingWeight ¶
func (lqw *LocalQueueWrapper) WithFairSharingWeight(weight string) *LocalQueueWrapper
WithFairSharingWeight sets the FairSharing weight for the LocalQueue.
func (*LocalQueueWrapper) WithGenerateName ¶
func (lqw *LocalQueueWrapper) WithGenerateName() *LocalQueueWrapper
WithGenerateName switches to using GenerateName with "local-queue-" prefix.
type PodWrapper ¶
PodWrapper wraps a Pod.
func MakeCurlMetricsPod ¶
func MakeCurlMetricsPod(namespace string) *PodWrapper
func MakePod ¶
func MakePod(name, ns string) *PodWrapper
type ResourceFlavorWrapper ¶
type ResourceFlavorWrapper struct {
*kueuev1beta2.ResourceFlavor
}
ResourceFlavorWrapper wraps a ResourceFlavor and provides builder methods.
func NewResourceFlavor ¶
func NewResourceFlavor() *ResourceFlavorWrapper
NewResourceFlavor creates a new wrapper with default values.
func (*ResourceFlavorWrapper) Create ¶
func (rfw *ResourceFlavorWrapper) Create(ctx context.Context, client *upstreamkueueclient.Clientset) (func(), error)
Create creates the ResourceFlavor in the cluster and returns cleanup function.
func (*ResourceFlavorWrapper) CreateWithObject ¶
func (rfw *ResourceFlavorWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.ResourceFlavor, func(), error)
CreateWithObject creates the ResourceFlavor in the cluster and returns the created object, cleanup function, and error.
func (*ResourceFlavorWrapper) WithGenerateName ¶
func (rfw *ResourceFlavorWrapper) WithGenerateName() *ResourceFlavorWrapper
WithGenerateName switches to using GenerateName with "resource-flavor-" prefix.
func (*ResourceFlavorWrapper) WithNodeLabel ¶
func (rfw *ResourceFlavorWrapper) WithNodeLabel(key, value string) *ResourceFlavorWrapper
WithNodeLabel adds a node label to the ResourceFlavor.
func (*ResourceFlavorWrapper) WithTopologyName ¶
func (rfw *ResourceFlavorWrapper) WithTopologyName(name string) *ResourceFlavorWrapper
WithTopologyName sets the topology name on the ResourceFlavor.
type TestClients ¶
type TestClients struct {
GenericClient client.Client
KubeClient *kubernetes.Clientset
APIExtClient *apiextv1.ApiextensionsV1Client
KueueClient *kueueclient.Clientset
UpstreamKueueClient *upstreamkueueclient.Clientset
DynamicClient dynamic.Interface
ApiregistrationClient *apiregistrationv1client.ApiregistrationV1Client
RestConfig *rest.Config
}
func NewTestClients ¶
func NewTestClients() *TestClients
type TestResourceBuilder ¶
type TestResourceBuilder struct {
// contains filtered or unexported fields
}
func NewTestResourceBuilder ¶
func NewTestResourceBuilder(namespace, queueName string) *TestResourceBuilder
func (*TestResourceBuilder) NewDRAExtendedResourceJob ¶
func (b *TestResourceBuilder) NewDRAExtendedResourceJob(name, queueName, extendedResource string, count int) *batchv1.Job
NewDRAExtendedResourceJob creates a Job with an extended resource request for DRA e2e tests.
func (*TestResourceBuilder) NewDRAJob ¶
func (b *TestResourceBuilder) NewDRAJob(name, queueName, templateName string) *batchv1.Job
NewDRAJob creates a Job with a DRA ResourceClaim for e2e tests.
func (*TestResourceBuilder) NewDeployment ¶
func (b *TestResourceBuilder) NewDeployment() *appsv1.Deployment
func (*TestResourceBuilder) NewDeploymentWithoutQueue ¶
func (b *TestResourceBuilder) NewDeploymentWithoutQueue() *appsv1.Deployment
func (*TestResourceBuilder) NewJob ¶
func (b *TestResourceBuilder) NewJob() *batchv1.Job
func (*TestResourceBuilder) NewJobSet ¶
func (b *TestResourceBuilder) NewJobSet() *jobsetapi.JobSet
func (*TestResourceBuilder) NewJobSetWithoutQueue ¶
func (b *TestResourceBuilder) NewJobSetWithoutQueue() *jobsetapi.JobSet
func (*TestResourceBuilder) NewJobWithoutQueue ¶
func (b *TestResourceBuilder) NewJobWithoutQueue() *batchv1.Job
func (*TestResourceBuilder) NewLeaderWorkerSet ¶
func (b *TestResourceBuilder) NewLeaderWorkerSet(opts LeaderWorkerSetOptions) *lwsapi.LeaderWorkerSet
NewLeaderWorkerSet creates a LeaderWorkerSet with optional queue name, priority class, and size.
func (*TestResourceBuilder) NewPod ¶
func (b *TestResourceBuilder) NewPod() *corev1.Pod
func (*TestResourceBuilder) NewPodWithoutQueue ¶
func (b *TestResourceBuilder) NewPodWithoutQueue() *corev1.Pod
func (*TestResourceBuilder) NewStatefulSet ¶
func (b *TestResourceBuilder) NewStatefulSet() *appsv1.StatefulSet
func (*TestResourceBuilder) NewStatefulSetWithoutQueue ¶
func (b *TestResourceBuilder) NewStatefulSetWithoutQueue() *appsv1.StatefulSet
type TopologyWrapper ¶
type TopologyWrapper struct {
*kueuev1beta2.Topology
}
TopologyWrapper wraps a Topology and provides builder methods.
func NewTopology ¶
func NewTopology() *TopologyWrapper
NewTopology creates a new wrapper with a default single-level hostname topology.
func (*TopologyWrapper) CreateWithObject ¶
func (tw *TopologyWrapper) CreateWithObject(ctx context.Context, client *upstreamkueueclient.Clientset) (*kueuev1beta2.Topology, func(), error)
CreateWithObject creates the Topology in the cluster and returns the created object, cleanup function, and error.
func (*TopologyWrapper) WithGenerateName ¶
func (tw *TopologyWrapper) WithGenerateName() *TopologyWrapper
WithGenerateName switches to using GenerateName with "topology-" prefix.
func (*TopologyWrapper) WithLevels ¶
func (tw *TopologyWrapper) WithLevels(labels []string) *TopologyWrapper
WithLevels sets the topology levels from a list of node label keys.