From bc2845ee085b63e01234473065cf58351aa052dc Mon Sep 17 00:00:00 2001 From: Stewart-YU Date: Mon, 30 Oct 2017 16:23:42 +0800 Subject: [PATCH] Add explain for preempt sunction. --- plugin/pkg/scheduler/scheduler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/pkg/scheduler/scheduler.go b/plugin/pkg/scheduler/scheduler.go index fcc6eec039f..04705047873 100644 --- a/plugin/pkg/scheduler/scheduler.go +++ b/plugin/pkg/scheduler/scheduler.go @@ -184,6 +184,9 @@ func (sched *Scheduler) schedule(pod *v1.Pod) (string, error) { return host, err } +// preempt tries to create room for a pod that has failed to schedule, by preempting lower priority pods if possible. +// If it succeeds, it adds the name of the node where preemption has happened to the pod annotations. +// It returns the node name and an error if any. func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, error) { if !utilfeature.DefaultFeatureGate.Enabled(features.PodPriority) { glog.V(3).Infof("Pod priority feature is not enabled. No preemption is performed.")