fix: register Pod/Delete event at the preemption plugin

This commit is contained in:
Kensei Nakada 2024-11-05 12:40:09 +09:00
parent 3124c5bd56
commit 677792663f

View File

@ -116,7 +116,13 @@ 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 nil, nil
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
}
// calculateNumCandidates returns the number of candidates the FindCandidates