-
Notifications
You must be signed in to change notification settings - Fork 254
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
WIP: reset admission check after deactivation #3350
base: main
Are you sure you want to change the base?
WIP: reset admission check after deactivation #3350
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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. |
Welcome @KPostOffice! |
Hi @KPostOffice. 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.
|
/ok-to-test |
4db1187
to
6f7c974
Compare
cc @PBundyra |
@KPostOffice PTAL at the failures, maybe we could include as bugfix in 0.9. |
6f7c974
to
f279f18
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: KPostOffice The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
dc8bc5a
to
a559886
Compare
cc @PBundyra for a review pass. It seems the failing integration tests are for BookingExpired. PTAL. |
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.
Could you add a scenario for deactivated test, to observe transition from DeactivationTarget
-> EvictedByDeactivation
and resetting Workload's AdmissionChecks and RequeueState
pkg/workload/admissionchecks.go
Outdated
checks[i] = kueue.AdmissionCheckState{ | ||
Name: checks[i].Name, | ||
State: kueue.CheckStatePending, | ||
LastTransitionTime: metav1.NewTime(time.Now()), |
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.
Could we use a clock used in WorkloadController?
a9d5dd0
to
37a4619
Compare
@@ -204,6 +204,7 @@ func (r *WorkloadReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c | |||
wl.Status.RequeueState = nil | |||
updated = true | |||
} | |||
updated = updated || workload.ResetChecksOnDeactivation(&wl) |
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.
swap the order: workload.ResetChecksOnDeactivation(&wl) || updated
otherwise ResetChecksOnDeactivation
may not be called if updated is already 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.
Ah, true. Thanks for catching 👍🏻
Signed-off-by: Kevin <[email protected]>
Signed-off-by: Kevin <[email protected]>
Signed-off-by: Kevin <[email protected]>
Signed-off-by: Kevin <[email protected]>
Signed-off-by: Kevin <[email protected]>
37a4619
to
ad6f582
Compare
Signed-off-by: Kevin <[email protected]>
@KPostOffice: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
updated = workload.ResetChecksOnDeactivation(&wl) || updated | ||
if updated { |
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.
updated = workload.ResetChecksOnDeactivation(&wl) || updated | |
if updated { | |
if workload.ResetChecksOnDeactivation(&wl, r.clock.Now()) || updated { |
var ( | ||
realClock = clock.RealClock{} | ||
) | ||
|
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.
var ( | |
realClock = clock.RealClock{} | |
) |
I don’t think this will work well. We need to use the same clock as WorkloadReconciler
, so we can replace it with FakeClock in tests.
Message: "Reset to Pending after eviction. Previously: " + string(checks[i].State), | ||
} | ||
} | ||
} | ||
|
||
func ResetChecksOnDeactivation(w *kueue.Workload) bool { |
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.
func ResetChecksOnDeactivation(w *kueue.Workload) bool { | |
func ResetChecksOnDeactivation(w *kueue.Workload, now time.Time) bool { |
checks[i] = kueue.AdmissionCheckState{ | ||
Name: checks[i].Name, | ||
State: kueue.CheckStatePending, | ||
LastTransitionTime: metav1.NewTime(realClock.Now()), |
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.
LastTransitionTime: metav1.NewTime(realClock.Now()), | |
LastTransitionTime: metav1.NewTime(now), |
Message: "Reset to Pending after eviction. Previously: " + string(checks[i].State), | ||
} | ||
} | ||
} | ||
|
||
func ResetChecksOnDeactivation(w *kueue.Workload) bool { |
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 don't think we need a new function for this, it is virtually the same as ResetChecksOnEviction
, the only differences being time
as a new arg and skipping of updating for Pending.
So, I would suggest to just update the existing function and reuse in this context. Deactivation is a special case of Eviction, so I think the name is also fine.
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.
Please adjust tests description according to your change
@@ -443,7 +435,7 @@ var _ = ginkgo.Describe("Provisioning", ginkgo.Ordered, ginkgo.ContinueOnFailure | |||
gomega.Eventually(func(g gomega.Gomega) { | |||
g.Expect(k8sClient.Get(ctx, wlKey, &updatedWl)).To(gomega.Succeed()) | |||
g.Expect(workload.IsEvictedByDeactivation(&updatedWl)).To(gomega.BeTrue()) | |||
util.ExpectEvictedWorkloadsTotalMetric(cq.Name, kueue.WorkloadEvictedByDeactivation, 1) | |||
util.ExpectEvictedWorkloadsTotalMetric(cq.Name, kueue.WorkloadEvictedByDeactivation+kueue.WorkloadEvictedByAdmissionCheck, 1) |
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.
Is the metric kueue.WorkloadEvictedByAdmissionCheck
increased in this scenario?
cool to see all integration and e2e tests passing already 👍 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #3346
Special notes for your reviewer:
Does this PR introduce a user-facing change?
NONE