mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #70602 from bsalamat/optimize_memory
Do not allocate memory for pods that do not have inter-pod affinity/a…
This commit is contained in:
commit
d50e920906
@ -399,7 +399,7 @@ func getTPMapMatchingExistingAntiAffinity(pod *v1.Pod, nodeInfoMap map[string]*s
|
|||||||
appendTopologyPairsMaps(existingPodTopologyMaps)
|
appendTopologyPairsMaps(existingPodTopologyMaps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
workqueue.Parallelize(16, len(allNodeNames), processNode)
|
workqueue.ParallelizeUntil(context.TODO(), 16, len(allNodeNames), processNode)
|
||||||
return topologyMaps, firstError
|
return topologyMaps, firstError
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,13 +408,12 @@ func getTPMapMatchingExistingAntiAffinity(pod *v1.Pod, nodeInfoMap map[string]*s
|
|||||||
// predicate. With this topologyPairsMaps available, the affinity predicate does not
|
// predicate. With this topologyPairsMaps available, the affinity predicate does not
|
||||||
// need to check all the pods in the cluster.
|
// need to check all the pods in the cluster.
|
||||||
func getTPMapMatchingIncomingAffinityAntiAffinity(pod *v1.Pod, nodeInfoMap map[string]*schedulercache.NodeInfo) (topologyPairsAffinityPodsMaps *topologyPairsMaps, topologyPairsAntiAffinityPodsMaps *topologyPairsMaps, err error) {
|
func getTPMapMatchingIncomingAffinityAntiAffinity(pod *v1.Pod, nodeInfoMap map[string]*schedulercache.NodeInfo) (topologyPairsAffinityPodsMaps *topologyPairsMaps, topologyPairsAntiAffinityPodsMaps *topologyPairsMaps, err error) {
|
||||||
allNodeNames := make([]string, 0, len(nodeInfoMap))
|
|
||||||
|
|
||||||
affinity := pod.Spec.Affinity
|
affinity := pod.Spec.Affinity
|
||||||
if affinity == nil || (affinity.PodAffinity == nil && affinity.PodAntiAffinity == nil) {
|
if affinity == nil || (affinity.PodAffinity == nil && affinity.PodAntiAffinity == nil) {
|
||||||
return newTopologyPairsMaps(), newTopologyPairsMaps(), nil
|
return newTopologyPairsMaps(), newTopologyPairsMaps(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allNodeNames := make([]string, 0, len(nodeInfoMap))
|
||||||
for name := range nodeInfoMap {
|
for name := range nodeInfoMap {
|
||||||
allNodeNames = append(allNodeNames, name)
|
allNodeNames = append(allNodeNames, name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user