Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #45 from everpeace/enqueue-extention
Browse files Browse the repository at this point in the history
register ClusterEvents for waking up pods in unschedulableQ quickly.
  • Loading branch information
everpeace committed Mar 18, 2022
2 parents 76d7bdc + 1a7590d commit 4d4f278
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions pkg/scheduler_plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type KubeThrottler struct {
}

var _ framework.PreFilterPlugin = &KubeThrottler{}
var _ framework.EnqueueExtensions = &KubeThrottler{}
var _ framework.ReservePlugin = &KubeThrottler{}

func (p *KubeThrottler) Name() string {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4d4f278

Please sign in to comment.