in pkg/controller/core/workload_controller.go [362:386]
func (r *WorkloadReconciler) admittedNotReadyWorkload(wl *kueue.Workload, clock clock.Clock) (bool, time.Duration) {
if r.podsReadyTimeout == nil {
// the timeout is not configured for the workload controller
return false, 0
}
if !workload.IsAdmitted(wl) {
// the workload is not admitted so there is no need to time it out
return false, 0
}
podsReadyCond := apimeta.FindStatusCondition(wl.Status.Conditions, kueue.WorkloadPodsReady)
if podsReadyCond != nil && podsReadyCond.Status == metav1.ConditionTrue {
return false, 0
}
admittedCond := apimeta.FindStatusCondition(wl.Status.Conditions, kueue.WorkloadAdmitted)
elapsedTime := clock.Since(admittedCond.LastTransitionTime.Time)
if podsReadyCond != nil && podsReadyCond.Status == metav1.ConditionFalse && podsReadyCond.LastTransitionTime.After(admittedCond.LastTransitionTime.Time) {
elapsedTime = clock.Since(podsReadyCond.LastTransitionTime.Time)
}
waitFor := *r.podsReadyTimeout - elapsedTime
if waitFor < 0 {
waitFor = 0
}
return true, waitFor
}