2016-03-14 04:58:28 +00:00
|
|
|
/*
|
2016-06-03 00:25:58 +00:00
|
|
|
Copyright 2015 The Kubernetes Authors.
|
2016-03-14 04:58:28 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2017-02-22 06:31:49 +00:00
|
|
|
package testing
|
2016-03-14 04:58:28 +00:00
|
|
|
|
|
|
|
import (
|
2017-06-22 17:25:57 +00:00
|
|
|
"k8s.io/api/core/v1"
|
2017-06-22 18:24:23 +00:00
|
|
|
"k8s.io/apimachinery/pkg/labels"
|
2016-03-14 04:58:28 +00:00
|
|
|
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PodsToCache is used for testing
|
2016-11-18 20:52:35 +00:00
|
|
|
type PodsToCache []*v1.Pod
|
2016-03-14 04:58:28 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) AssumePod(pod *v1.Pod) error { return nil }
|
2016-07-13 09:47:07 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) ForgetPod(pod *v1.Pod) error { return nil }
|
2016-03-14 04:58:28 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) AddPod(pod *v1.Pod) error { return nil }
|
2016-03-14 04:58:28 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) UpdatePod(oldPod, newPod *v1.Pod) error { return nil }
|
2016-03-14 04:58:28 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) RemovePod(pod *v1.Pod) error { return nil }
|
2016-03-14 04:58:28 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) AddNode(node *v1.Node) error { return nil }
|
2016-04-21 08:24:12 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) UpdateNode(oldNode, newNode *v1.Node) error { return nil }
|
2016-04-21 08:24:12 +00:00
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) RemoveNode(node *v1.Node) error { return nil }
|
2016-04-21 08:24:12 +00:00
|
|
|
|
2016-05-04 11:32:05 +00:00
|
|
|
func (p PodsToCache) UpdateNodeNameToInfoMap(infoMap map[string]*schedulercache.NodeInfo) error {
|
|
|
|
return nil
|
2016-03-14 04:58:28 +00:00
|
|
|
}
|
|
|
|
|
2016-11-18 20:52:35 +00:00
|
|
|
func (p PodsToCache) List(s labels.Selector) (selected []*v1.Pod, err error) {
|
2016-03-14 04:58:28 +00:00
|
|
|
for _, pod := range p {
|
|
|
|
if s.Matches(labels.Set(pod.Labels)) {
|
|
|
|
selected = append(selected, pod)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return selected, nil
|
|
|
|
}
|