Skip to content

Commit 6897fda

Browse files
committed
scheduler: correct dated comments on pod preemption
- correct wordings related with annotations - which hasn't been used since alpha version
1 parent 152f0a1 commit 6897fda

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

pkg/scheduler/factory/factory.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ type Config struct {
9090
// with scheduling, PodScheduled condition will be updated in apiserver in /bind
9191
// handler so that binding and setting PodCondition it is atomic.
9292
PodConditionUpdater PodConditionUpdater
93-
// PodPreemptor is used to evict pods and update pod annotations.
93+
// PodPreemptor is used to evict pods and update 'NominatedNode' field of
94+
// the preemptor pod.
9495
PodPreemptor PodPreemptor
9596
// PlugingSet has a set of plugins and data used to run them.
9697
PluginSet pluginsv1alpha1.PluginSet
@@ -125,8 +126,8 @@ type Config struct {
125126
SchedulingQueue internalqueue.SchedulingQueue
126127
}
127128

128-
// PodPreemptor has methods needed to delete a pod and to update
129-
// annotations of the preemptor pod.
129+
// PodPreemptor has methods needed to delete a pod and to update 'NominatedPod'
130+
// field of the preemptor pod.
130131
type PodPreemptor interface {
131132
GetUpdatedPod(pod *v1.Pod) (*v1.Pod, error)
132133
DeletePod(pod *v1.Pod) error

pkg/scheduler/scheduler.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (sched *Scheduler) schedule(pod *v1.Pod) (core.ScheduleResult, error) {
285285
}
286286

287287
// preempt tries to create room for a pod that has failed to schedule, by preempting lower priority pods if possible.
288-
// If it succeeds, it adds the name of the node where preemption has happened to the pod annotations.
288+
// If it succeeds, it adds the name of the node where preemption has happened to the pod spec.
289289
// It returns the node name and an error if any.
290290
func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, error) {
291291
preemptor, err := sched.config.PodPreemptor.GetUpdatedPod(preemptor)
@@ -310,7 +310,7 @@ func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, e
310310
// Make a call to update nominated node name of the pod on the API server.
311311
err = sched.config.PodPreemptor.SetNominatedNodeName(preemptor, nodeName)
312312
if err != nil {
313-
klog.Errorf("Error in preemption process. Cannot update pod %v/%v annotations: %v", preemptor.Namespace, preemptor.Name, err)
313+
klog.Errorf("Error in preemption process. Cannot set 'NominatedPod' on pod %v/%v: %v", preemptor.Namespace, preemptor.Name, err)
314314
sched.config.SchedulingQueue.DeleteNominatedPodIfExists(preemptor)
315315
return "", err
316316
}
@@ -327,11 +327,12 @@ func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, e
327327
// Clearing nominated pods should happen outside of "if node != nil". Node could
328328
// be nil when a pod with nominated node name is eligible to preempt again,
329329
// but preemption logic does not find any node for it. In that case Preempt()
330-
// function of generic_scheduler.go returns the pod itself for removal of the annotation.
330+
// function of generic_scheduler.go returns the pod itself for removal of
331+
// the 'NominatedPod' field.
331332
for _, p := range nominatedPodsToClear {
332333
rErr := sched.config.PodPreemptor.RemoveNominatedNodeName(p)
333334
if rErr != nil {
334-
klog.Errorf("Cannot remove nominated node annotation of pod: %v", rErr)
335+
klog.Errorf("Cannot remove 'NominatedPod' field of pod: %v", rErr)
335336
// We do not return as this error is not critical.
336337
}
337338
}

0 commit comments

Comments
 (0)