mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Produce map according to the shorter array in haveOverlap
This commit is contained in:
parent
62f5fd4c6c
commit
02e0f9c5fd
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user