unroll extenders

Signed-off-by: Jerry Ge <jerry.ge@arm.com>

Co-authored-by: Huang-Wei <wei.huang1@ibm.com>
This commit is contained in:
Jerry-Ge
2021-06-03 10:38:57 +08:00
parent 2cefcc6be7
commit 110c39ef60
8 changed files with 40 additions and 59 deletions

View File

@@ -71,6 +71,8 @@ type Scheduler struct {
Algorithm core.ScheduleAlgorithm
Extenders []framework.Extender
// NextPod should be a function that blocks until the next pod
// is available. We don't use a channel for this, because scheduling
// a pod may take some amount of time and we don't want pods to get
@@ -449,7 +451,7 @@ func (sched *Scheduler) bind(ctx context.Context, fwk framework.Framework, assum
// TODO(#87159): Move this to a Plugin.
func (sched *Scheduler) extendersBinding(pod *v1.Pod, node string) (bool, error) {
for _, extender := range sched.Algorithm.Extenders() {
for _, extender := range sched.Extenders {
if !extender.IsBinder() || !extender.IsInterested(pod) {
continue
}
@@ -500,7 +502,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
state.SetRecordPluginMetrics(rand.Intn(100) < pluginMetricsSamplePercent)
schedulingCycleCtx, cancel := context.WithCancel(ctx)
defer cancel()
scheduleResult, err := sched.Algorithm.Schedule(schedulingCycleCtx, fwk, state, pod)
scheduleResult, err := sched.Algorithm.Schedule(schedulingCycleCtx, sched.Extenders, fwk, state, pod)
if err != nil {
// Schedule() may have failed because the pod would not fit on any host, so we try to
// preempt, with the expectation that the next time the pod is tried for scheduling it