Change:
What would you like to be : When the pod is scheduled to the phase and I delete the pod, the pod still remains in the until the plugin allow/reject/timeout(Especially when waiting for a long time). Why is this needed: We need to take the initiative to delete the data in the and terminate the process in waiting state of plugin to ensure data accuracy, if the pod has been deleted /cc /priority important-soon /assign /sig scheduling
I think we can update the event handler for deleting pods to reject the pod. Can you send a PR for that?
OKI will send a pr for it.

Discussion:
// Volume binder only wants to keep unassigned pods sched.VolumeBinder.DeletePodBindings(pod) } <ins> sched.Framework.RejectWaitingPod(pod.UID) </ins> } func (sched *Scheduler) addPodToCache(obj interface{}) {

"//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", <ins> "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", </ins> "//vendor/github.com/prometheus/client_golang/prometheus:go_default_library", "//vendor/github.com/prometheus/client_model/go:go_default_library", ],

return f.waitingPods.get(uid) } <ins> // RejectWaitingPod rejects a WaitingPod given its UID. func (f *framework) RejectWaitingPod(uid types.UID) { waitingPod := f.waitingPods.get(uid) if waitingPod != nil { waitingPod.Reject("removed") } } </ins> // HasFilterPlugins returns true if at least one filter plugin is defined. func (f *framework) HasFilterPlugins() bool { return len(f.filterPlugins) > 0

v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" <ins> "k8s.io/apimachinery/pkg/types" </ins> "k8s.io/kubernetes/pkg/scheduler/apis/config" "k8s.io/kubernetes/pkg/scheduler/metrics" schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"

preFilterWithExtensionsPluginName = "prefilter-with-extensions-plugin" duplicatePluginName               = "duplicate-plugin" testPlugin                        = "test-plugin" <ins> permitPlugin                      = "permit-plugin" </ins> ) // TestScoreWithNormalizePlugin implements ScoreWithNormalizePlugin interface.

return &TestDuplicatePlugin{}, nil } <ins> // TestPermitPlugin only implements PermitPlugin interface. type TestPermitPlugin struct { PreFilterCalled int } func (pp *TestPermitPlugin) Name() string { return permitPlugin } func (pp *TestPermitPlugin) Permit(ctx context.Context, state *CycleState, p *v1.Pod, nodeName string) (*Status, time.Duration) { return NewStatus(Wait, ""), time.Duration(10 * time.Second) } </ins> var registry Registry = func() Registry { r := make(Registry) r.Register(scoreWithNormalizePlugin1, newScoreWithNormalizePlugin1)

} } <ins> func TestRejectWaitingPod(t *testing.T) { pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "pod", UID:  types.UID("pod"), }, } testPermitPlugin := &TestPermitPlugin{} r := make(Registry) r.Register(permitPlugin, func(_ *runtime.Unknown, fh FrameworkHandle) (Plugin, error) { return testPermitPlugin, nil }) plugins := &config.Plugins{ Permit: &config.PluginSet{Enabled: []config.Plugin{{Name: permitPlugin, Weight: 1}}}, } f, err := NewFramework(r, plugins, emptyArgs) if err != nil { t.Fatalf("Failed to create framework for testing: %v", err) } go func() { for { waitingPod := f.GetWaitingPod(pod.UID) if waitingPod != nil { break } } f.RejectWaitingPod(pod.UID) }() permitStatus := f.RunPermitPlugins(context.Background(), nil, pod, "") if permitStatus.message != "pod "pod" rejected while waiting at permit: removed" { t.Fatalf("RejectWaitingPod failed, permitStatus: %v", permitStatus) } } </ins> func buildScoreConfigDefaultWeights(ps ...string) *config.Plugins { return buildScoreConfigWithWeights(defaultWeights, ps...) }

// GetWaitingPod returns a waiting pod given its UID. GetWaitingPod(uid types.UID) WaitingPod <ins> // RejectWaitingPod rejects a waiting pod given its UID. RejectWaitingPod(uid types.UID) </ins> // ClientSet returns a kubernetes clientSet. ClientSet() clientset.Interface

return nil } <ins> func (*fakeFramework) RejectWaitingPod(uid types.UID) { } </ins> func (*fakeFramework) ClientSet() clientset.Interface { return nil }