diff --git a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go index 71e53f52009..c9144cb175e 100644 --- a/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go +++ b/pkg/scheduler/framework/plugins/defaultpreemption/default_preemption.go @@ -116,13 +116,9 @@ func (pl *DefaultPreemption) PreEnqueue(ctx context.Context, p *v1.Pod) *framewo // EventsToRegister returns the possible events that may make a Pod // failed by this plugin schedulable. func (pl *DefaultPreemption) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error) { - return []framework.ClusterEventWithHint{ - // We don't need any QHint for the event - // because the Pod rejected by the preemption plugin is the one that is running the preemption, - // and the Pod won't be requeued until all the preemption API calls are completed - // (we block the Pod from being requeued at PreEnqueue). - {Event: framework.ClusterEvent{Resource: framework.Pod, ActionType: framework.Delete}}, - }, nil + // The plugin moves the preemptor Pod to acviteQ/backoffQ once the preemption API calls are all done, + // and we don't need to move the Pod with any events. + return nil, nil } // calculateNumCandidates returns the number of candidates the FindCandidates diff --git a/pkg/scheduler/framework/preemption/preemption.go b/pkg/scheduler/framework/preemption/preemption.go index 3f478c75d2a..924898b3fe4 100644 --- a/pkg/scheduler/framework/preemption/preemption.go +++ b/pkg/scheduler/framework/preemption/preemption.go @@ -209,8 +209,7 @@ func (ev *Evaluator) IsPodRunningPreemption(podUID types.UID) bool { ev.mu.RLock() defer ev.mu.RUnlock() - _, ok := ev.preempting[podUID] - return ok + return ev.preempting.Has(podUID) } // Preempt returns a PostFilterResult carrying suggested nominatedNodeName, along with a Status. @@ -483,7 +482,7 @@ func (ev *Evaluator) prepareCandidateAsync(c Candidate, pod *v1.Pod, pluginName } ev.mu.Lock() - ev.preempting[pod.UID] = struct{}{} + ev.preempting.Insert(pod.UID) ev.mu.Unlock() logger := klog.FromContext(ctx) @@ -494,7 +493,7 @@ func (ev *Evaluator) prepareCandidateAsync(c Candidate, pod *v1.Pod, pluginName defer metrics.PreemptionGoroutinesExecutionTotal.WithLabelValues(result).Inc() defer func() { ev.mu.Lock() - delete(ev.preempting, pod.UID) + ev.preempting.Delete(pod.UID) ev.mu.Unlock() ev.Handler.Activate(logger, map[string]*v1.Pod{pod.Name: pod}) }()