Skip to content

Commit

Permalink
Merge pull request kubernetes#76288 from tedyu/master
Browse files Browse the repository at this point in the history
Produce map according to the shorter array in haveOverlap
  • Loading branch information
k8s-ci-robot authored Apr 9, 2019
2 parents 2d0e5c1 + 02e0f9c commit 4a1da48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/scheduler/algorithm/predicates/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
func haveOverlap(a1, a2 []string) bool {
if len(a1) > len(a2) {
a1, a2 = a2, a1
}
m := map[string]bool{}

for _, val := range a1 {
Expand Down

0 comments on commit 4a1da48

Please sign in to comment.