From 1a7590d9ea4e22b7f9f117df61031c2806908b28 Mon Sep 17 00:00:00 2001 From: Shingo Omura Date: Fri, 18 Mar 2022 23:08:37 +0900 Subject: [PATCH] register ClusterEvents for waking up pods in unschedulableQ timely. --- Makefile | 2 +- pkg/scheduler_plugin/plugin.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index db8f560..d04f15d 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ dev-run-debug: dev-scheduler-conf # # E2E test # -export E2E_GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT=90s +export E2E_GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT=180s export E2E_GOMEGA_DEFAULT_CONSISTENTLY_DURATION=2s E2E_PAUSE_IMAGE=k8s.gcr.io/pause:3.2 E2E_KIND_KUBECNOFIG = $(DEV_TOOL_PREFIX)/.kubeconfig diff --git a/pkg/scheduler_plugin/plugin.go b/pkg/scheduler_plugin/plugin.go index c181951..07a4080 100644 --- a/pkg/scheduler_plugin/plugin.go +++ b/pkg/scheduler_plugin/plugin.go @@ -52,6 +52,7 @@ type KubeThrottler struct { } var _ framework.PreFilterPlugin = &KubeThrottler{} +var _ framework.EnqueueExtensions = &KubeThrottler{} var _ framework.ReservePlugin = &KubeThrottler{} func (p *KubeThrottler) Name() string { @@ -261,6 +262,24 @@ func (p *KubeThrottler) PreFilterExtensions() framework.PreFilterExtensions { return nil } +func (p *KubeThrottler) EventsToRegister() []framework.ClusterEvent { + throttlesGVK := framework.GVK(fmt.Sprintf("throttles.%v.%v", schedulev1alpha1.SchemeGroupVersion.Version, schedulev1alpha1.SchemeGroupVersion.Group)) + clusterthrottlesGVK := framework.GVK(fmt.Sprintf("clusterthrottles.%v.%v", schedulev1alpha1.SchemeGroupVersion.Version, schedulev1alpha1.SchemeGroupVersion.Group)) + return []framework.ClusterEvent{{ + Resource: framework.Node, + ActionType: framework.All, + }, { + Resource: framework.Pod, + ActionType: framework.All, + }, { + Resource: throttlesGVK, + ActionType: framework.All, + }, { + Resource: clusterthrottlesGVK, + ActionType: framework.All, + }} +} + func throttleNames(objs []schedulev1alpha1.Throttle) []string { names := make([]string, len(objs)) for i, obj := range objs {