mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
Merge pull request #102558 from Jerry-Ge/unroll-extenders
Unroll ScheduleAlgorithm#Extenders() to Scheduler.go
This commit is contained in:
@@ -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
|
||||
@@ -461,7 +463,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
|
||||
}
|
||||
@@ -512,7 +514,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
|
||||
|
Reference in New Issue
Block a user