mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Modify CalculateAntiAffinityPriority function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
This commit is contained in:
parent
437e133b34
commit
e4ab32cde2
@ -195,6 +195,10 @@ func NewServiceAntiAffinityPriority(podLister algorithm.PodLister, serviceLister
|
||||
// The label to be considered is provided to the struct (ServiceAntiAffinity).
|
||||
func (s *ServiceAntiAffinity) CalculateAntiAffinityPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodeLister algorithm.NodeLister) (schedulerapi.HostPriorityList, error) {
|
||||
var nsServicePods []*api.Pod
|
||||
nodes, err := nodeLister.List()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if services, err := s.serviceLister.GetPodServices(pod); err == nil {
|
||||
// just use the first service and get the other pods within the service
|
||||
@ -212,11 +216,6 @@ func (s *ServiceAntiAffinity) CalculateAntiAffinityPriority(pod *api.Pod, nodeNa
|
||||
}
|
||||
}
|
||||
|
||||
nodes, err := nodeLister.List()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// separate out the nodes that have the label from the ones that don't
|
||||
otherNodes := []string{}
|
||||
labeledNodes := map[string]string{}
|
||||
|
Loading…
Reference in New Issue
Block a user