fix based on reviews

This commit is contained in:
Kensei Nakada 2023-10-20 02:53:06 +00:00
parent cb5dc46edf
commit 4f5bc7e8d7
4 changed files with 9 additions and 9 deletions

View File

@ -180,7 +180,7 @@ type Status struct {
reasons []string reasons []string
err error err error
// failedPlugin is an optional field that records the plugin name a Pod failed by. // failedPlugin is an optional field that records the plugin name a Pod failed by.
// It's set by the framework when code is Unschedulable or UnschedulableAndUnresolvable. // It's set by the framework when code is Unschedulable, UnschedulableAndUnresolvable or Pending.
failedPlugin string failedPlugin string
} }

View File

@ -304,7 +304,7 @@ const (
NoNodeAvailableMsg = "0/%v nodes are available" NoNodeAvailableMsg = "0/%v nodes are available"
) )
func (d *Diagnosis) SetFailedPlugin(sts *Status) { func (d *Diagnosis) AddPluginStatus(sts *Status) {
if sts.FailedPlugin() == "" { if sts.FailedPlugin() == "" {
return return
} }

View File

@ -451,7 +451,7 @@ func (p *PriorityQueue) isPodWorthRequeuing(logger klog.Logger, pInfo *framework
continue continue
} }
h, err := hintfn.QueueingHintFn(logger, pod, oldObj, newObj) hint, err := hintfn.QueueingHintFn(logger, pod, oldObj, newObj)
if err != nil { if err != nil {
// If the QueueingHintFn returned an error, we should treat the event as Queue so that we can prevent // If the QueueingHintFn returned an error, we should treat the event as Queue so that we can prevent
// the Pod from being stuck in the unschedulable pod pool. // the Pod from being stuck in the unschedulable pod pool.
@ -461,9 +461,9 @@ func (p *PriorityQueue) isPodWorthRequeuing(logger klog.Logger, pInfo *framework
} else { } else {
logger.Error(err, "QueueingHintFn returns error", "event", event, "plugin", hintfn.PluginName, "pod", klog.KObj(pod), "oldObj", klog.KObj(oldObjMeta), "newObj", klog.KObj(newObjMeta)) logger.Error(err, "QueueingHintFn returns error", "event", event, "plugin", hintfn.PluginName, "pod", klog.KObj(pod), "oldObj", klog.KObj(oldObjMeta), "newObj", klog.KObj(newObjMeta))
} }
h = framework.Queue hint = framework.Queue
} }
if h == framework.QueueSkip { if hint == framework.QueueSkip {
continue continue
} }

View File

@ -214,7 +214,7 @@ func (sched *Scheduler) schedulingCycle(
NodeToStatusMap: framework.NodeToStatusMap{scheduleResult.SuggestedHost: sts}, NodeToStatusMap: framework.NodeToStatusMap{scheduleResult.SuggestedHost: sts},
}, },
} }
fitErr.Diagnosis.SetFailedPlugin(sts) fitErr.Diagnosis.AddPluginStatus(sts)
return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, framework.NewStatus(sts.Code()).WithError(fitErr) return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, framework.NewStatus(sts.Code()).WithError(fitErr)
} }
return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, sts return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, sts
@ -237,7 +237,7 @@ func (sched *Scheduler) schedulingCycle(
NodeToStatusMap: framework.NodeToStatusMap{scheduleResult.SuggestedHost: runPermitStatus}, NodeToStatusMap: framework.NodeToStatusMap{scheduleResult.SuggestedHost: runPermitStatus},
}, },
} }
fitErr.Diagnosis.SetFailedPlugin(runPermitStatus) fitErr.Diagnosis.AddPluginStatus(runPermitStatus)
return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, framework.NewStatus(runPermitStatus.Code()).WithError(fitErr) return ScheduleResult{nominatingInfo: clearNominatedNode}, assumedPodInfo, framework.NewStatus(runPermitStatus.Code()).WithError(fitErr)
} }
@ -458,7 +458,7 @@ func (sched *Scheduler) findNodesThatFitPod(ctx context.Context, fwk framework.F
msg := s.Message() msg := s.Message()
diagnosis.PreFilterMsg = msg diagnosis.PreFilterMsg = msg
logger.V(5).Info("Status after running PreFilter plugins for pod", "pod", klog.KObj(pod), "status", msg) logger.V(5).Info("Status after running PreFilter plugins for pod", "pod", klog.KObj(pod), "status", msg)
diagnosis.SetFailedPlugin(s) diagnosis.AddPluginStatus(s)
return nil, diagnosis, nil return nil, diagnosis, nil
} }
@ -569,7 +569,7 @@ func (sched *Scheduler) findNodesThatPassFilters(
} else { } else {
statusesLock.Lock() statusesLock.Lock()
diagnosis.NodeToStatusMap[nodeInfo.Node().Name] = status diagnosis.NodeToStatusMap[nodeInfo.Node().Name] = status
diagnosis.SetFailedPlugin(status) diagnosis.AddPluginStatus(status)
statusesLock.Unlock() statusesLock.Unlock()
} }
} }