From dbac18a909b09f32bbee792fc748a7f97a4079f6 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Tue, 13 Jan 2015 09:52:37 -0800 Subject: [PATCH] Rebasing onto latest code and fixing issues --- pkg/scheduler/predicates.go | 2 +- pkg/scheduler/spreading.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/scheduler/predicates.go b/pkg/scheduler/predicates.go index babbd8037a0..a7137c30d60 100644 --- a/pkg/scheduler/predicates.go +++ b/pkg/scheduler/predicates.go @@ -259,7 +259,7 @@ func (s *ServiceAffinity) CheckServiceAffinity(pod api.Pod, existingPods []api.P // just use the first service and get the other pods within the service // TODO: a separate predicate can be created that tries to handle all services for the pod selector := labels.SelectorFromSet(services[0].Spec.Selector) - servicePods, err := s.podLister.ListPods(selector) + servicePods, err := s.podLister.List(selector) if err != nil { return false, err } diff --git a/pkg/scheduler/spreading.go b/pkg/scheduler/spreading.go index 8bd31cc5cb7..f72f19c93ff 100644 --- a/pkg/scheduler/spreading.go +++ b/pkg/scheduler/spreading.go @@ -32,9 +32,8 @@ func NewServiceSpreadPriority(serviceLister ServiceLister) PriorityFunction { return serviceSpread.CalculateSpreadPriority } -// CalculateSpreadPriority spreads pods by minimizing the number of pods on the same machine with the same labels. -// Importantly, if there are services in the system that span multiple heterogenous sets of pods, this spreading priority -// may not provide optimal spreading for the members of that Service. +// CalculateSpreadPriority spreads pods by minimizing the number of pods belonging to the same service +// on the same machine. func (s *ServiceSpread) CalculateSpreadPriority(pod api.Pod, podLister PodLister, minionLister MinionLister) (HostPriorityList, error) { var maxCount int var pods []api.Pod @@ -45,7 +44,7 @@ func (s *ServiceSpread) CalculateSpreadPriority(pod api.Pod, podLister PodLister // just use the first service and get the other pods within the service // TODO: a separate predicate can be created that tries to handle all services for the pod selector := labels.SelectorFromSet(services[0].Spec.Selector) - pods, err = podLister.ListPods(selector) + pods, err = podLister.List(selector) if err != nil { return nil, err } @@ -105,7 +104,7 @@ func (s *ServiceAntiAffinity) CalculateAntiAffinityPriority(pod api.Pod, podList // just use the first service and get the other pods within the service // TODO: a separate predicate can be created that tries to handle all services for the pod selector := labels.SelectorFromSet(services[0].Spec.Selector) - pods, err = podLister.ListPods(selector) + pods, err = podLister.List(selector) if err != nil { return nil, err }