Skip to content

Commit

Permalink
Improve logging of workload status (#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimowo committed Apr 25, 2024
1 parent 8d5eba2 commit 3d764d5
Showing 1 changed file with 10 additions and 6 deletions.
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) {
return admitted
}
if workload.HasQuotaReservation(w) {
return quotaReserved
}
return pending
}

Expand Down

0 comments on commit 3d764d5

Please sign in to comment.