Rename ListPods methods to List.

For greater similarity to pkg/client.
Does not cover registry's ListPods.
Fix an example in a comment.
This commit is contained in:
Eric Tune
2015-01-07 21:57:45 -08:00
parent 6cd37637f5
commit 00c05053b7
8 changed files with 16 additions and 15 deletions

View File

@@ -36,15 +36,15 @@ func (f FakeMinionLister) List() (api.NodeList, error) {
// PodLister interface represents anything that can list pods for a scheduler.
type PodLister interface {
// TODO: make this exactly the same as client's ListPods() method...
ListPods(labels.Selector) ([]api.Pod, error)
// TODO: make this exactly the same as client's Pods(ns).List() method, by returning a api.PodList
List(labels.Selector) ([]api.Pod, error)
}
// FakePodLister implements PodLister on an []api.Pods for test purposes.
type FakePodLister []api.Pod
// ListPods returns []api.Pod matching a query.
func (f FakePodLister) ListPods(s labels.Selector) (selected []api.Pod, err error) {
// List returns []api.Pod matching a query.
func (f FakePodLister) List(s labels.Selector) (selected []api.Pod, err error) {
for _, pod := range f {
if s.Matches(labels.Set(pod.Labels)) {
selected = append(selected, pod)

View File

@@ -198,7 +198,7 @@ func getUsedPorts(pods ...api.Pod) map[int]bool {
func MapPodsToMachines(lister PodLister) (map[string][]api.Pod, error) {
machineToPods := map[string][]api.Pod{}
// TODO: perform more targeted query...
pods, err := lister.ListPods(labels.Everything())
pods, err := lister.List(labels.Everything())
if err != nil {
return map[string][]api.Pod{}, err
}

View File

@@ -28,7 +28,7 @@ import (
// may not provide optimal spreading for the members of that Service.
// TODO: consider if we want to include Service label sets in the scheduling priority.
func CalculateSpreadPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error) {
pods, err := podLister.ListPods(labels.SelectorFromSet(pod.Labels))
pods, err := podLister.List(labels.SelectorFromSet(pod.Labels))
if err != nil {
return nil, err
}