func()

in pkg/coscheduling/coscheduling.go [205:237]


func (cs *Coscheduling) Permit(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (*framework.Status, time.Duration) {
	waitTime := *cs.scheduleTimeout
	s := cs.pgMgr.Permit(ctx, state, pod)
	var retStatus *framework.Status
	switch s {
	case core.PodGroupNotSpecified:
		return framework.NewStatus(framework.Success, ""), 0
	case core.PodGroupNotFound:
		return framework.NewStatus(framework.Unschedulable, "PodGroup not found"), 0
	case core.Wait:
		klog.InfoS("Pod is waiting to be scheduled to node", "pod", klog.KObj(pod), "nodeName", nodeName)
		_, pg := cs.pgMgr.GetPodGroup(ctx, pod)
		if wait := util.GetWaitTimeDuration(pg, cs.scheduleTimeout); wait != 0 {
			waitTime = wait
		}
		retStatus = framework.NewStatus(framework.Wait)
		// We will also request to move the sibling pods back to activeQ.
		cs.pgMgr.ActivateSiblings(pod, state)
	case core.Success:
		pgFullName := util.GetPodGroupFullName(pod)
		cs.frameworkHandler.IterateOverWaitingPods(func(waitingPod framework.WaitingPod) {
			if util.GetPodGroupFullName(waitingPod.GetPod()) == pgFullName {
				klog.V(3).InfoS("Permit allows", "pod", klog.KObj(waitingPod.GetPod()))
				waitingPod.Allow(cs.Name())
			}
		})
		klog.V(3).InfoS("Permit allows", "pod", klog.KObj(pod))
		retStatus = framework.NewStatus(framework.Success)
		waitTime = 0
	}

	return retStatus, waitTime
}