diff --git a/pkg/scheduler/eventhandlers_test.go b/pkg/scheduler/eventhandlers_test.go index 752fc7b3299..fe6ba7abb0a 100644 --- a/pkg/scheduler/eventhandlers_test.go +++ b/pkg/scheduler/eventhandlers_test.go @@ -105,13 +105,12 @@ func TestSkipPodUpdate(t *testing.T) { } for _, test := range table { t.Run(test.name, func(t *testing.T) { - c := NewFromConfig(&Config{ + c := &Scheduler{ SchedulerCache: &fakecache.Cache{ IsAssumedPodFunc: test.isAssumedPodFunc, GetPodFunc: test.getPodFunc, }, - }, - ) + } got := c.skipPodUpdate(test.pod) if got != test.expected { t.Errorf("skipPodUpdate() = %t, expected = %t", got, test.expected) diff --git a/pkg/scheduler/factory.go b/pkg/scheduler/factory.go index e2f07a4c8c5..2cef6304d2e 100644 --- a/pkg/scheduler/factory.go +++ b/pkg/scheduler/factory.go @@ -42,7 +42,6 @@ import ( storagelistersv1 "k8s.io/client-go/listers/storage/v1" storagelistersv1beta1 "k8s.io/client-go/listers/storage/v1beta1" "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/events" "k8s.io/klog" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/scheduler/algorithm" @@ -70,46 +69,6 @@ type Binder interface { Bind(binding *v1.Binding) error } -// Config is an implementation of the Scheduler's configured input data. -// TODO over time we should make this struct a hidden implementation detail of the scheduler. -type Config struct { - SchedulerCache internalcache.Cache - - Algorithm core.ScheduleAlgorithm - GetBinder func(pod *v1.Pod) Binder - // Framework runs scheduler plugins at configured extension points. - Framework framework.Framework - - // NextPod should be a function that blocks until the next pod - // is available. We don't use a channel for this, because scheduling - // a pod may take some amount of time and we don't want pods to get - // stale while they sit in a channel. - NextPod func() *framework.PodInfo - - // Error is called if there is an error. It is passed the pod in - // question, and the error - Error func(*framework.PodInfo, error) - - // Recorder is the EventRecorder to use - Recorder events.EventRecorder - - // Close this to shut down the scheduler. - StopEverything <-chan struct{} - - // VolumeBinder handles PVC/PV binding for the pod. - VolumeBinder *volumebinder.VolumeBinder - - // Disable pod preemption or not. - DisablePreemption bool - - // SchedulingQueue holds pods to be scheduled - SchedulingQueue internalqueue.SchedulingQueue - - // The final configuration of the framework. - Plugins schedulerapi.Plugins - PluginConfig []schedulerapi.PluginConfig -} - // Configurator defines I/O, caching, and other functionality needed to // construct a new scheduler. type Configurator struct { diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 89eb8151672..b2afd8d5154 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -405,24 +405,6 @@ func initPolicyFromConfigMap(client clientset.Interface, policyRef *schedulerapi return nil } -// NewFromConfig returns a new scheduler using the provided Config. -func NewFromConfig(config *Config) *Scheduler { - metrics.Register() - return &Scheduler{ - SchedulerCache: config.SchedulerCache, - Algorithm: config.Algorithm, - GetBinder: config.GetBinder, - Framework: config.Framework, - NextPod: config.NextPod, - Error: config.Error, - Recorder: config.Recorder, - StopEverything: config.StopEverything, - VolumeBinder: config.VolumeBinder, - DisablePreemption: config.DisablePreemption, - SchedulingQueue: config.SchedulingQueue, - } -} - // Run begins watching and scheduling. It waits for cache to be synced, then starts scheduling and blocked until the context is done. func (sched *Scheduler) Run(ctx context.Context) { if !cache.WaitForCacheSync(ctx.Done(), sched.scheduledPodsHasSynced) {