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
5d268eb1
Commit
5d268eb1
authored
Oct 27, 2017
by
Yongkun Anfernee Gui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
haveSame is suboptimal, fix it as well as the name
parent
68b9fa2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
predicates.go
plugin/pkg/scheduler/algorithm/predicates/predicates.go
+6
-8
No files found.
plugin/pkg/scheduler/algorithm/predicates/predicates.go
View file @
5d268eb1
...
...
@@ -165,7 +165,7 @@ func isVolumeConflict(volume v1.Volume, pod *v1.Pod) bool {
// two RBDs images are the same if they share the same Ceph monitor, are in the same RADOS Pool, and have the same image name
// only one read-write mount is permitted for the same RBD image.
// same RBD image mounted by multiple Pods conflicts unless all Pods mount the image read-only
if
have
Same
(
mon
,
emon
)
&&
pool
==
epool
&&
image
==
eimage
&&
!
(
volume
.
RBD
.
ReadOnly
&&
existingVolume
.
RBD
.
ReadOnly
)
{
if
have
Overlap
(
mon
,
emon
)
&&
pool
==
epool
&&
image
==
eimage
&&
!
(
volume
.
RBD
.
ReadOnly
&&
existingVolume
.
RBD
.
ReadOnly
)
{
return
true
}
}
...
...
@@ -911,20 +911,18 @@ func PodFitsHostPorts(pod *v1.Pod, meta algorithm.PredicateMetadata, nodeInfo *s
}
// search two arrays and return true if they have at least one common element; return false otherwise
func
have
Same
(
a1
,
a2
[]
string
)
bool
{
m
:=
map
[
string
]
int
{}
func
have
Overlap
(
a1
,
a2
[]
string
)
bool
{
m
:=
map
[
string
]
bool
{}
for
_
,
val
:=
range
a1
{
m
[
val
]
=
1
m
[
val
]
=
true
}
for
_
,
val
:=
range
a2
{
m
[
val
]
=
m
[
val
]
+
1
}
for
_
,
val
:=
range
m
{
if
val
>
1
{
if
_
,
ok
:=
m
[
val
];
ok
{
return
true
}
}
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