-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow podSet count to be 0 #2268
Allow podSet count to be 0 #2268
Conversation
|
Welcome @mszadkow! |
Hi @mszadkow. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
/assign @trasc |
/ok-to-test |
/check-cla |
fe52608
to
667abab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a test for job or other workloads? I don’t know if others allow for 0 replicas but it may be worth checking this out as we are increasing coverage for this case.
WDYT @alculquicondor @tenzen-y?
667abab
to
9e11d9e
Compare
fab9c44
to
d61f84d
Compare
Jobset is a bit trickier, because it can have a podset with zero and one without. I would like to have coverage for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the file podset_reducer.go
might be doing some divisions by zero.
We might need some unit tests in this area.
That makes sense. |
d61f84d
to
5c6603a
Compare
test/integration/controller/jobs/jobset/jobset_controller_test.go
Outdated
Show resolved
Hide resolved
test/integration/controller/jobs/jobset/jobset_controller_test.go
Outdated
Show resolved
Hide resolved
test/integration/controller/jobs/jobset/jobset_controller_test.go
Outdated
Show resolved
Hide resolved
test/integration/controller/jobs/jobset/jobset_controller_test.go
Outdated
Show resolved
Hide resolved
test/integration/controller/jobs/jobset/jobset_controller_test.go
Outdated
Show resolved
Hide resolved
5c6603a
to
a2e9d90
Compare
a2e9d90
to
4f9ab1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/assign @tenzen-y @alculquicondor
LGTM label has been added. Git tree hash: 2ee38303bb981831212704c06e291216036e7ed6
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure that you just copy and paste, but I really want to improve debuggability.
So, could you address my comments in followup PR since I don't want to block new release due to my comments.
/approve
gomega.Expect(k8sClient.Create(ctx, mixJobSet)).Should(gomega.Succeed()) | ||
gomega.Eventually(func() *bool { | ||
createdJobSet1 := &jobsetapi.JobSet{} | ||
gomega.Expect(k8sClient.Get(ctx, jobSetLookupKey, createdJobSet1)).Should(gomega.Succeed()) | ||
return createdJobSet1.Spec.Suspend | ||
}, util.Timeout, util.Interval).Should(gomega.Equal(ptr.To(true))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Expect(k8sClient.Create(ctx, mixJobSet)).Should(gomega.Succeed()) | |
gomega.Eventually(func() *bool { | |
createdJobSet1 := &jobsetapi.JobSet{} | |
gomega.Expect(k8sClient.Get(ctx, jobSetLookupKey, createdJobSet1)).Should(gomega.Succeed()) | |
return createdJobSet1.Spec.Suspend | |
}, util.Timeout, util.Interval).Should(gomega.Equal(ptr.To(true))) | |
gomega.Expect(k8sClient.Create(ctx, mixJobSet)).Should(gomega.Succeed()) | |
gomega.Eventually(func(g gomega.Gomega) *bool { | |
createdJobSet1 := &jobsetapi.JobSet{} | |
g.Expect(k8sClient.Get(ctx, jobSetLookupKey, createdJobSet1)).Should(gomega.Succeed()) | |
g.Expect(createdJobSet1.Spec.Suspend).ShouldNot(gomega.BeNil()) | |
g.Expect(createdJobSet1.Spec.Suspend).Should(gomega.BeTrue()) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded) |
I would suggest passing the gomega instance via arg to increase debuggability.
err := k8sClient.Create(ctx, jobSet) | ||
gomega.Expect(err).To(gomega.Succeed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := k8sClient.Create(ctx, jobSet) | |
gomega.Expect(err).To(gomega.Succeed()) | |
k8sClient.Create(ctx, jobSet).To(gomega.Succeded()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean:
gomega.Expect(k8sClient.Create(ctx, jobSet)).To(gomega.Succeed())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that's right :)
gomega.Eventually(func() bool { | ||
if err := k8sClient.Get(ctx, types.NamespacedName{Name: jobSetName, Namespace: ns.Name}, createdJobSet); err != nil { | ||
return false | ||
} | ||
return ptr.Deref(createdJobSet.Spec.Suspend, false) | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
if err := k8sClient.Get(ctx, types.NamespacedName{Name: jobSetName, Namespace: ns.Name}, createdJobSet); err != nil { | |
return false | |
} | |
return ptr.Deref(createdJobSet.Spec.Suspend, false) | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, types.NamespacedName{Name: jobSetName, Namespace: ns.Name}, createdJobSet)).Should(gomega.Succeeded()) | |
g.Expect(ptr.Deref(createdJobSet.Spec.Suspend, false)).Should(gomega.BeTrue()) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() bool { | ||
if err := k8sClient.Get(ctx, wlLookupKey, createdWorkload); err != nil { | ||
return false | ||
} | ||
return createdWorkload.Spec.QueueName == jobSetQueueName | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
if err := k8sClient.Get(ctx, wlLookupKey, createdWorkload); err != nil { | |
return false | |
} | |
return createdWorkload.Spec.QueueName == jobSetQueueName | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeeded) | |
g.Expect(createdWorkload.Spec.QueueName).Should(gomga.Equal(jobSetQueueName)) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() error { | ||
wl := &kueue.Workload{} | ||
key := types.NamespacedName{Name: secondWl.Name, Namespace: secondWl.Namespace} | ||
return k8sClient.Get(ctx, key, wl) | ||
}, util.Timeout, util.Interval).Should(testing.BeNotFoundError()) | ||
// check the original wl is still there | ||
gomega.Eventually(func() error { | ||
return k8sClient.Get(ctx, wlLookupKey, createdWorkload) | ||
}, util.Timeout, util.Interval).Should(gomega.Succeed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() error { | |
wl := &kueue.Workload{} | |
key := types.NamespacedName{Name: secondWl.Name, Namespace: secondWl.Namespace} | |
return k8sClient.Get(ctx, key, wl) | |
}, util.Timeout, util.Interval).Should(testing.BeNotFoundError()) | |
// check the original wl is still there | |
gomega.Eventually(func() error { | |
return k8sClient.Get(ctx, wlLookupKey, createdWorkload) | |
}, util.Timeout, util.Interval).Should(gomega.Succeed()) | |
key := types.NamespacedName{Name: secondWl.Name, Namespace: secondWl.Namespace} | |
gomega.Eventually(func(g gomega.Gomega) { | |
wl := &kueue.Workload{} | |
g.Expect(k8sClient.Get(ctx, key, wl)).Should(testing.BeNotFoundError()) | |
// check the original wl is still there | |
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeeded()) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded) |
gomega.Eventually(func() bool { | ||
if err := k8sClient.Get(ctx, lookupKey, createdJobSet); err != nil { | ||
return false | ||
} | ||
return createdJobSet.Spec.Suspend != nil && *createdJobSet.Spec.Suspend && | ||
len(jobSet.Spec.ReplicatedJobs[0].Template.Spec.Template.Spec.NodeSelector) == 0 | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
if err := k8sClient.Get(ctx, lookupKey, createdJobSet); err != nil { | |
return false | |
} | |
return createdJobSet.Spec.Suspend != nil && *createdJobSet.Spec.Suspend && | |
len(jobSet.Spec.ReplicatedJobs[0].Template.Spec.Template.Spec.NodeSelector) == 0 | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, lookupKey, createdJobSet)).Should(gomega.Succeeded()) | |
g.Expect(createdJobSet.Spec.Suspend).ShouldNot(gomega.BeNil()) | |
g.Expect(*createdJobSet.Spec.Suspend).Should(gomega.BeTrue()) | |
g.Expect(jobSet.Spec.ReplicatedJobs[0].Template.Spec.Template.Spec.NodeSelector).Should(gomega.HaveLen(0)) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() bool { | ||
ok, _ := testing.CheckLatestEvent(ctx, k8sClient, "DeletedWorkload", corev1.EventTypeNormal, fmt.Sprintf("Deleted not matching Workload: %v", wlLookupKey.String())) | ||
return ok | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
ok, _ := testing.CheckLatestEvent(ctx, k8sClient, "DeletedWorkload", corev1.EventTypeNormal, fmt.Sprintf("Deleted not matching Workload: %v", wlLookupKey.String())) | |
return ok | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
ok, _ := testing.CheckLatestEvent(ctx, k8sClient, "DeletedWorkload", corev1.EventTypeNormal, fmt.Sprintf("Deleted not matching Workload: %v", wlLookupKey.String())) | |
g.Expect(ok).Should(gomega.BeTrue()) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() bool { | ||
if err := k8sClient.Get(ctx, wlLookupKey, createdWorkload); err != nil { | ||
return false | ||
} | ||
return createdWorkload.Spec.PodSets[0].Count == newParallelism | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
if err := k8sClient.Get(ctx, wlLookupKey, createdWorkload); err != nil { | |
return false | |
} | |
return createdWorkload.Spec.PodSets[0].Count == newParallelism | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload).Should(gomega.Succeeded()) | |
g.Expect(createdWorkload.Spec.PodSets[0].Count).Should(gomega.Equal(newParallelism)) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() bool { | ||
if err := k8sClient.Get(ctx, lookupKey, createdJobSet); err != nil { | ||
return false | ||
} | ||
return !*createdJobSet.Spec.Suspend | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
if err := k8sClient.Get(ctx, lookupKey, createdJobSet); err != nil { | |
return false | |
} | |
return !*createdJobSet.Spec.Suspend | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, lookupKey, createdJobSet)).Should(gomega.Succeeded()) | |
g.Expect(createdJobSet.Spec.Suspend).ShouldNot(gomega.BeNil()) | |
g.Expect(*createdJobSet.Spec.Suspend).Should(gomega.BeFalse) | |
}, util.Timeout, util.Interval).Should(gomega.Succeeded()) |
gomega.Eventually(func() bool { | ||
err := k8sClient.Get(ctx, wlLookupKey, createdWorkload) | ||
if err != nil { | ||
return false | ||
} | ||
return apimeta.IsStatusConditionTrue(createdWorkload.Status.Conditions, kueue.WorkloadFinished) | ||
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gomega.Eventually(func() bool { | |
err := k8sClient.Get(ctx, wlLookupKey, createdWorkload) | |
if err != nil { | |
return false | |
} | |
return apimeta.IsStatusConditionTrue(createdWorkload.Status.Conditions, kueue.WorkloadFinished) | |
}, util.Timeout, util.Interval).Should(gomega.BeTrue()) | |
util.ExpectWorkloadToFinish(... |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mimowo, mszadkow, tenzen-y, vladikkuzn The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Sure, I will provide new PR. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Allow for
workload.spec.podSet.[*].count
to be 0Which issue(s) this PR fixes:
Fixes #2227
Special notes for your reviewer:
Does this PR introduce a user-facing change?