From b4c0207da050d573353dac7116e7f0f64f1f17ba Mon Sep 17 00:00:00 2001 From: lowang_bh Date: Fri, 2 Jun 2023 17:08:47 +0800 Subject: [PATCH] recover binder register and get Signed-off-by: lowang_bh --- pkg/scheduler/cache/cache.go | 6 +++++- pkg/scheduler/cache/factory.go | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/cache/cache.go b/pkg/scheduler/cache/cache.go index e09a2506c67..617a86eb99d 100644 --- a/pkg/scheduler/cache/cache.go +++ b/pkg/scheduler/cache/cache.go @@ -476,7 +476,6 @@ func newSchedulerCache(config *rest.Config, schedulerNames []string, defaultQueu sc.Recorder = broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: commonutil.GenerateComponentName(sc.schedulerNames)}) sc.BindFlowChannel = make(chan *schedulingapi.TaskInfo, 5000) - sc.Binder = NewBinder(sc.kubeClient, sc.Recorder) var batchNum int batchNum, err = strconv.Atoi(os.Getenv("BATCH_BIND_NUM")) @@ -486,6 +485,11 @@ func newSchedulerCache(config *rest.Config, schedulerNames []string, defaultQueu sc.batchNum = 1 } + sc.Binder = &DefaultBinder{ + kubeclient: sc.kubeClient, + recorder: sc.Recorder, + } + sc.Evictor = &defaultEvictor{ kubeclient: sc.kubeClient, recorder: sc.Recorder, diff --git a/pkg/scheduler/cache/factory.go b/pkg/scheduler/cache/factory.go index 08bf029d305..41aa52052e9 100644 --- a/pkg/scheduler/cache/factory.go +++ b/pkg/scheduler/cache/factory.go @@ -1 +1,14 @@ package cache + +// bindMethodMap Binder management +var bindMethodMap Binder + +// RegisterBindMethod register Bind Method +func RegisterBindMethod(binder Binder) { + bindMethodMap = binder +} + +// GetBindMethod get the registered Binder +func GetBindMethod() Binder { + return bindMethodMap +}