Merge pull request #76288 from tedyu/master

Produce map according to the shorter array in haveOverlap
k3s-v1.15.3
Kubernetes Prow Robot 2019-04-08 17:27:52 -07:00 committed by GitHub
commit 4a1da48d11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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 {