generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address comments and test with BestEffortFIFO
Change-Id: Ib5d6109878510cc0ce6cf3f15c43052cd8338cce
- Loading branch information
1 parent
0f528e9
commit 0cef5b3
Showing
4 changed files
with
60 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1075,31 +1075,39 @@ var _ = ginkgo.Describe("Scheduler", func() { | |
util.ExpectWorkloadsToHaveQuotaReservation(ctx, k8sClient, devCQ.Name, dWl1) | ||
}) | ||
|
||
ginkgo.It("Should try next flavor instead of pending", func() { | ||
ginkgo.FIt("Should try next flavor if can't preempt on first", func() { | ||
prodCQ = testing.MakeClusterQueue("prod-cq"). | ||
Cohort("all"). | ||
This comment has been minimized.
Sorry, something went wrong.
alculquicondor
Author
Contributor
|
||
ResourceGroup( | ||
*testing.MakeFlavorQuotas("on-demand").Resource(corev1.ResourceCPU, "2").Obj(), | ||
*testing.MakeFlavorQuotas("spot-untainted").Resource(corev1.ResourceCPU, "2").Obj()). | ||
Preemption(kueue.ClusterQueuePreemption{ | ||
WithinClusterQueue: kueue.PreemptionPolicyLowerPriority, | ||
}). | ||
FlavorFungibility(kueue.FlavorFungibility{ | ||
WhenCanPreempt: kueue.Preempt, | ||
}). | ||
Obj() | ||
gomega.Expect(k8sClient.Create(ctx, prodCQ)).Should(gomega.Succeed()) | ||
|
||
prodQueue := testing.MakeLocalQueue("prod-queue", ns.Name).ClusterQueue(prodCQ.Name).Obj() | ||
gomega.Expect(k8sClient.Create(ctx, prodQueue)).Should(gomega.Succeed()) | ||
|
||
ginkgo.By("Creating 3 workloads") | ||
ginkgo.By("Creating 2 workloads and ensuring they are admitted") | ||
wl1 := testing.MakeWorkload("wl-1", ns.Name).Queue(prodQueue.Name).Request(corev1.ResourceCPU, "1").Obj() | ||
wl2 := testing.MakeWorkload("wl-2", ns.Name).Queue(prodQueue.Name).Request(corev1.ResourceCPU, "1").Obj() | ||
wl3 := testing.MakeWorkload("wl-3", ns.Name).Queue(prodQueue.Name).Request(corev1.ResourceCPU, "1").Obj() | ||
gomega.Expect(k8sClient.Create(ctx, wl1)).Should(gomega.Succeed()) | ||
gomega.Expect(k8sClient.Create(ctx, wl2)).Should(gomega.Succeed()) | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl1, | ||
testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "on-demand", "1").Obj()) | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl2, | ||
testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "on-demand", "1").Obj()) | ||
|
||
ginkgo.By("Creating an additional workload that can't fit in the first flavor") | ||
wl3 := testing.MakeWorkload("wl-3", ns.Name).Queue(prodQueue.Name).Request(corev1.ResourceCPU, "1").Obj() | ||
gomega.Expect(k8sClient.Create(ctx, wl3)).Should(gomega.Succeed()) | ||
prodWl1Admission := testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "on-demand", "1").Obj() | ||
prodWl2Admission := testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "on-demand", "1").Obj() | ||
prodWl3Admission := testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "spot-untainted", "1").Obj() | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl1, prodWl1Admission) | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl2, prodWl2Admission) | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl3, prodWl3Admission) | ||
util.ExpectWorkloadToBeAdmittedAs(ctx, k8sClient, wl3, | ||
testing.MakeAdmission(prodCQ.Name).Assignment(corev1.ResourceCPU, "spot-untainted", "1").Obj()) | ||
util.ExpectPendingWorkloadsMetric(prodCQ, 0, 0) | ||
util.ExpectReservingActiveWorkloadsMetric(prodCQ, 3) | ||
util.ExpectAdmittedWorkloadsTotalMetric(prodCQ, 3) | ||
|
The unit tests pass with StrictFIFO.
We probably should put the workload back into the queue immediately while we haven't tried all the flavors.