diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index fe66270215..e8ec9d1e33 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -78,17 +78,16 @@ func (sched *Scheduler) StopEverything() { // construct a new scheduler. An implementation of this can be seen in // factory.go. type Configurator interface { - GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error) - GetPriorityMetadataProducer() (algorithm.PriorityMetadataProducer, error) - GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error) - GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error) + // Exposed for testing GetHardPodAffinitySymmetricWeight() int32 - GetSchedulerName() string + // Exposed for testing MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error) // Needs to be exposed for things like integration tests where we want to make fake nodes. GetNodeLister() corelisters.NodeLister + // Exposed for testing GetClient() clientset.Interface + // Exposed for testing GetScheduledPodLister() corelisters.PodLister Create() (*Config, error) diff --git a/pkg/scheduler/testing/BUILD b/pkg/scheduler/testing/BUILD index 45d1459db4..d1fa65c61d 100644 --- a/pkg/scheduler/testing/BUILD +++ b/pkg/scheduler/testing/BUILD @@ -11,7 +11,6 @@ go_library( srcs = [ "fake_cache.go", "fake_lister.go", - "pods_to_cache.go", "util.go", ], importpath = "k8s.io/kubernetes/pkg/scheduler/testing", diff --git a/pkg/scheduler/testing/pods_to_cache.go b/pkg/scheduler/testing/pods_to_cache.go deleted file mode 100644 index ecb237bfbd..0000000000 --- a/pkg/scheduler/testing/pods_to_cache.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/labels" - schedulercache "k8s.io/kubernetes/pkg/scheduler/cache" -) - -// PodsToCache is used for testing -type PodsToCache []*v1.Pod - -// AssumePod returns nil. -func (p PodsToCache) AssumePod(pod *v1.Pod) error { return nil } - -// ForgetPod returns nil. -func (p PodsToCache) ForgetPod(pod *v1.Pod) error { return nil } - -// AddPod returns nil. -func (p PodsToCache) AddPod(pod *v1.Pod) error { return nil } - -// UpdatePod returns nil. -func (p PodsToCache) UpdatePod(oldPod, newPod *v1.Pod) error { return nil } - -// RemovePod returns nil. -func (p PodsToCache) RemovePod(pod *v1.Pod) error { return nil } - -// AddNode returns nil. -func (p PodsToCache) AddNode(node *v1.Node) error { return nil } - -// UpdateNode returns nil. -func (p PodsToCache) UpdateNode(oldNode, newNode *v1.Node) error { return nil } - -// RemoveNode returns nil. -func (p PodsToCache) RemoveNode(node *v1.Node) error { return nil } - -// UpdateNodeNameToInfoMap returns nil. -func (p PodsToCache) UpdateNodeNameToInfoMap(infoMap map[string]*schedulercache.NodeInfo) error { - return nil -} - -// List returns pods matching the label selector. -func (p PodsToCache) List(s labels.Selector) (selected []*v1.Pod, err error) { - for _, pod := range p { - if s.Matches(labels.Set(pod.Labels)) { - selected = append(selected, pod) - } - } - return selected, nil -} diff --git a/pkg/scheduler/testutil.go b/pkg/scheduler/testutil.go index 4302b913b5..552068d1fd 100644 --- a/pkg/scheduler/testutil.go +++ b/pkg/scheduler/testutil.go @@ -17,8 +17,6 @@ limitations under the License. package scheduler import ( - "fmt" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" clientset "k8s.io/client-go/kubernetes" @@ -34,36 +32,11 @@ type FakeConfigurator struct { Config *Config } -// GetPriorityFunctionConfigs is not implemented yet. -func (fc *FakeConfigurator) GetPriorityFunctionConfigs(priorityKeys sets.String) ([]algorithm.PriorityConfig, error) { - return nil, fmt.Errorf("not implemented") -} - -// GetPriorityMetadataProducer is not implemented yet. -func (fc *FakeConfigurator) GetPriorityMetadataProducer() (algorithm.PriorityMetadataProducer, error) { - return nil, fmt.Errorf("not implemented") -} - -// GetPredicateMetadataProducer is not implemented yet. -func (fc *FakeConfigurator) GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error) { - return nil, fmt.Errorf("not implemented") -} - -// GetPredicates is not implemented yet. -func (fc *FakeConfigurator) GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error) { - return nil, fmt.Errorf("not implemented") -} - // GetHardPodAffinitySymmetricWeight is not implemented yet. func (fc *FakeConfigurator) GetHardPodAffinitySymmetricWeight() int32 { panic("not implemented") } -// GetSchedulerName is not implemented yet. -func (fc *FakeConfigurator) GetSchedulerName() string { - panic("not implemented") -} - // MakeDefaultErrorFunc is not implemented yet. func (fc *FakeConfigurator) MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error) { return nil