make scheduler_perf usable from other repositories

This commit is contained in:
Kensei Nakada
2023-12-01 12:42:10 +00:00
parent 1f07da7575
commit 5310abe14a
7 changed files with 1623 additions and 1560 deletions

View File

@@ -67,6 +67,7 @@ import (
configtesting "k8s.io/kubernetes/pkg/scheduler/apis/config/testing"
schedulerframework "k8s.io/kubernetes/pkg/scheduler/framework"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
"k8s.io/kubernetes/pkg/scheduler/profile"
st "k8s.io/kubernetes/pkg/scheduler/testing"
taintutils "k8s.io/kubernetes/pkg/util/taints"
@@ -82,7 +83,7 @@ type ShutdownFunc func()
// StartScheduler configures and starts a scheduler given a handle to the clientSet interface
// and event broadcaster. It returns the running scheduler and podInformer. Background goroutines
// will keep running until the context is canceled.
func StartScheduler(ctx context.Context, clientSet clientset.Interface, kubeConfig *restclient.Config, cfg *kubeschedulerconfig.KubeSchedulerConfiguration) (*scheduler.Scheduler, informers.SharedInformerFactory) {
func StartScheduler(ctx context.Context, clientSet clientset.Interface, kubeConfig *restclient.Config, cfg *kubeschedulerconfig.KubeSchedulerConfiguration, outOfTreePluginRegistry frameworkruntime.Registry) (*scheduler.Scheduler, informers.SharedInformerFactory) {
informerFactory := scheduler.NewInformerFactory(clientSet, 0)
evtBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{
Interface: clientSet.EventsV1()})
@@ -107,7 +108,9 @@ func StartScheduler(ctx context.Context, clientSet clientset.Interface, kubeConf
scheduler.WithPodMaxBackoffSeconds(cfg.PodMaxBackoffSeconds),
scheduler.WithPodInitialBackoffSeconds(cfg.PodInitialBackoffSeconds),
scheduler.WithExtenders(cfg.Extenders...),
scheduler.WithParallelism(cfg.Parallelism))
scheduler.WithParallelism(cfg.Parallelism),
scheduler.WithFrameworkOutOfTreeRegistry(outOfTreePluginRegistry),
)
if err != nil {
logger.Error(err, "Error creating scheduler")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)