Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
22e4abaf
Commit
22e4abaf
authored
Jun 14, 2017
by
zhangxiaoyu-zidif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor slice intersection
parent
5d2dbb58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
predicates.go
plugin/pkg/scheduler/algorithm/predicates/predicates.go
+11
-5
No files found.
plugin/pkg/scheduler/algorithm/predicates/predicates.go
View file @
22e4abaf
...
@@ -886,11 +886,17 @@ func PodFitsHostPorts(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.No
...
@@ -886,11 +886,17 @@ func PodFitsHostPorts(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.No
// 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
haveSame
(
a1
,
a2
[]
string
)
bool
{
func
haveSame
(
a1
,
a2
[]
string
)
bool
{
for
_
,
val1
:=
range
a1
{
m
:=
map
[
string
]
int
{}
for
_
,
val2
:=
range
a2
{
if
val1
==
val2
{
for
_
,
val
:=
range
a1
{
return
true
m
[
val
]
=
1
}
}
for
_
,
val
:=
range
a2
{
m
[
val
]
=
m
[
val
]
+
1
}
for
_
,
val
:=
range
m
{
if
val
>
1
{
return
true
}
}
}
}
return
false
return
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment