Commit 02e0f9c5 authored by Ted Yu's avatar Ted Yu Committed by Ted Yu

Produce map according to the shorter array in haveOverlap

parent 62f5fd4c
...@@ -1095,6 +1095,9 @@ func PodFitsHostPorts(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulerno ...@@ -1095,6 +1095,9 @@ func PodFitsHostPorts(pod *v1.Pod, meta PredicateMetadata, nodeInfo *schedulerno
// search two arrays and return true if they have at least one common element; return false otherwise // search two arrays and return true if they have at least one common element; return false otherwise
func haveOverlap(a1, a2 []string) bool { func haveOverlap(a1, a2 []string) bool {
if len(a1) > len(a2) {
a1, a2 = a2, a1
}
m := map[string]bool{} m := map[string]bool{}
for _, val := range a1 { for _, val := range a1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment