From b1143da37044d83ee8565193e598c02448c01278 Mon Sep 17 00:00:00 2001 From: jingxueli Date: Thu, 14 May 2020 15:43:54 +0800 Subject: [PATCH] skip unnecessary scheduling attempt when pod's finalizers change --- pkg/scheduler/eventhandlers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/eventhandlers.go b/pkg/scheduler/eventhandlers.go index 0b4f6d99011..be491488cfd 100644 --- a/pkg/scheduler/eventhandlers.go +++ b/pkg/scheduler/eventhandlers.go @@ -301,7 +301,7 @@ func responsibleForPod(pod *v1.Pod, profiles profile.Map) bool { // skipPodUpdate checks whether the specified pod update should be ignored. // This function will return true if // - The pod has already been assumed, AND -// - The pod has only its ResourceVersion, Spec.NodeName and/or Annotations +// - The pod has only its ResourceVersion, Spec.NodeName, Annotations, ManagedFields and/or Finalizers // updated. func (sched *Scheduler) skipPodUpdate(pod *v1.Pod) bool { // Non-assumed pods should never be skipped. @@ -338,6 +338,8 @@ func (sched *Scheduler) skipPodUpdate(pod *v1.Pod) bool { // Same as above, when annotations are modified with ServerSideApply, // ManagedFields may also change and must be excluded p.ManagedFields = nil + // Finalizers must be excluded because scheduled result can not be affected + p.Finalizers = nil return p } assumedPodCopy, podCopy := f(assumedPod), f(pod)