Skip to content
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

Improve logging of workload status #2062

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions pkg/controller/core/workload_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ import (

const (
// statuses for logging purposes
pending = "pending"
admitted = "admitted"
finished = "finished"
pending = "pending"
quotaReserved = "quotaReserved"
admitted = "admitted"
finished = "finished"
)

var (
Expand Down Expand Up @@ -539,12 +540,12 @@ func (r *WorkloadReconciler) Update(e event.UpdateEvent) bool {
log.V(2).Info("Queue for updated workload didn't exist; ignoring for now")
}

case prevStatus == pending && status == admitted:
case prevStatus == pending && (status == quotaReserved || status == admitted):
r.queues.DeleteWorkload(oldWl)
if !r.cache.AddOrUpdateWorkload(wlCopy) {
log.V(2).Info("ClusterQueue for workload didn't exist; ignored for now")
}
case prevStatus == admitted && status == pending:
case (prevStatus == quotaReserved || prevStatus == admitted) && status == pending:
// trigger the move of associated inadmissibleWorkloads, if there are any.
r.queues.QueueAssociatedInadmissibleWorkloadsAfter(ctx, wl, func() {
// Delete the workload from cache while holding the queues lock
Expand Down Expand Up @@ -660,9 +661,12 @@ func workloadStatus(w *kueue.Workload) string {
if apimeta.IsStatusConditionTrue(w.Status.Conditions, kueue.WorkloadFinished) {
return finished
}
if workload.HasQuotaReservation(w) {
if workload.IsAdmitted(w) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need this distinction? Can we just track quotaReserved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking about it, and chose this approach because:

  1. just renaming to quotaReserved would mean we still have misleading logs, but the other way round
  2. having more granular status might be helpful, for example here we only need to enter for admitted

I guess if we have too many occurences of (quotaReserved || admitted) then we could wrap them with quotaReservedOrAdmitted helper function.

return admitted
}
if workload.HasQuotaReservation(w) {
return quotaReserved
}
return pending
}

Expand Down