mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
scheduler: correct dated comments on pod preemption
- correct wordings related with annotations - which hasn't been used since alpha version
This commit is contained in:
parent
152f0a150e
commit
6897fda878
@ -90,7 +90,8 @@ type Config struct {
|
|||||||
// with scheduling, PodScheduled condition will be updated in apiserver in /bind
|
// with scheduling, PodScheduled condition will be updated in apiserver in /bind
|
||||||
// handler so that binding and setting PodCondition it is atomic.
|
// handler so that binding and setting PodCondition it is atomic.
|
||||||
PodConditionUpdater PodConditionUpdater
|
PodConditionUpdater PodConditionUpdater
|
||||||
// PodPreemptor is used to evict pods and update pod annotations.
|
// PodPreemptor is used to evict pods and update 'NominatedNode' field of
|
||||||
|
// the preemptor pod.
|
||||||
PodPreemptor PodPreemptor
|
PodPreemptor PodPreemptor
|
||||||
// PlugingSet has a set of plugins and data used to run them.
|
// PlugingSet has a set of plugins and data used to run them.
|
||||||
PluginSet pluginsv1alpha1.PluginSet
|
PluginSet pluginsv1alpha1.PluginSet
|
||||||
@ -125,8 +126,8 @@ type Config struct {
|
|||||||
SchedulingQueue internalqueue.SchedulingQueue
|
SchedulingQueue internalqueue.SchedulingQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodPreemptor has methods needed to delete a pod and to update
|
// PodPreemptor has methods needed to delete a pod and to update 'NominatedPod'
|
||||||
// annotations of the preemptor pod.
|
// field of the preemptor pod.
|
||||||
type PodPreemptor interface {
|
type PodPreemptor interface {
|
||||||
GetUpdatedPod(pod *v1.Pod) (*v1.Pod, error)
|
GetUpdatedPod(pod *v1.Pod) (*v1.Pod, error)
|
||||||
DeletePod(pod *v1.Pod) error
|
DeletePod(pod *v1.Pod) error
|
||||||
|
@ -285,7 +285,7 @@ func (sched *Scheduler) schedule(pod *v1.Pod) (core.ScheduleResult, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// preempt tries to create room for a pod that has failed to schedule, by preempting lower priority pods if possible.
|
// 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.
|
// If it succeeds, it adds the name of the node where preemption has happened to the pod spec.
|
||||||
// It returns the node name and an error if any.
|
// It returns the node name and an error if any.
|
||||||
func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, error) {
|
func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, error) {
|
||||||
preemptor, err := sched.config.PodPreemptor.GetUpdatedPod(preemptor)
|
preemptor, err := sched.config.PodPreemptor.GetUpdatedPod(preemptor)
|
||||||
@ -310,7 +310,7 @@ func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, e
|
|||||||
// Make a call to update nominated node name of the pod on the API server.
|
// Make a call to update nominated node name of the pod on the API server.
|
||||||
err = sched.config.PodPreemptor.SetNominatedNodeName(preemptor, nodeName)
|
err = sched.config.PodPreemptor.SetNominatedNodeName(preemptor, nodeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Error in preemption process. Cannot update pod %v/%v annotations: %v", preemptor.Namespace, preemptor.Name, err)
|
klog.Errorf("Error in preemption process. Cannot set 'NominatedPod' on pod %v/%v: %v", preemptor.Namespace, preemptor.Name, err)
|
||||||
sched.config.SchedulingQueue.DeleteNominatedPodIfExists(preemptor)
|
sched.config.SchedulingQueue.DeleteNominatedPodIfExists(preemptor)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -327,11 +327,12 @@ func (sched *Scheduler) preempt(preemptor *v1.Pod, scheduleErr error) (string, e
|
|||||||
// Clearing nominated pods should happen outside of "if node != nil". Node could
|
// Clearing nominated pods should happen outside of "if node != nil". Node could
|
||||||
// be nil when a pod with nominated node name is eligible to preempt again,
|
// be nil when a pod with nominated node name is eligible to preempt again,
|
||||||
// but preemption logic does not find any node for it. In that case Preempt()
|
// but preemption logic does not find any node for it. In that case Preempt()
|
||||||
// function of generic_scheduler.go returns the pod itself for removal of the annotation.
|
// function of generic_scheduler.go returns the pod itself for removal of
|
||||||
|
// the 'NominatedPod' field.
|
||||||
for _, p := range nominatedPodsToClear {
|
for _, p := range nominatedPodsToClear {
|
||||||
rErr := sched.config.PodPreemptor.RemoveNominatedNodeName(p)
|
rErr := sched.config.PodPreemptor.RemoveNominatedNodeName(p)
|
||||||
if rErr != nil {
|
if rErr != nil {
|
||||||
klog.Errorf("Cannot remove nominated node annotation of pod: %v", rErr)
|
klog.Errorf("Cannot remove 'NominatedPod' field of pod: %v", rErr)
|
||||||
// We do not return as this error is not critical.
|
// We do not return as this error is not critical.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user