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
d4736468
Commit
d4736468
authored
Jan 09, 2017
by
mqliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix for PodToleratesNodeTaints
parent
de59ede6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
predicates.go
plugin/pkg/scheduler/algorithm/predicates/predicates.go
+1
-6
predicates_test.go
plugin/pkg/scheduler/algorithm/predicates/predicates_test.go
+25
-0
No files found.
plugin/pkg/scheduler/algorithm/predicates/predicates.go
View file @
d4736468
...
...
@@ -1180,11 +1180,6 @@ func tolerationsToleratesTaints(tolerations []v1.Toleration, taints []v1.Taint)
return
true
}
// The taint list isn't nil/empty, a nil/empty toleration list can't tolerate them.
if
len
(
tolerations
)
==
0
{
return
false
}
for
i
:=
range
taints
{
taint
:=
&
taints
[
i
]
// skip taints that have effect PreferNoSchedule, since it is for priorities
...
...
@@ -1192,7 +1187,7 @@ func tolerationsToleratesTaints(tolerations []v1.Toleration, taints []v1.Taint)
continue
}
if
!
v1
.
TaintToleratedByTolerations
(
taint
,
tolerations
)
{
if
len
(
tolerations
)
==
0
||
!
v1
.
TaintToleratedByTolerations
(
taint
,
tolerations
)
{
return
false
}
}
...
...
plugin/pkg/scheduler/algorithm/predicates/predicates_test.go
View file @
d4736468
...
...
@@ -3060,6 +3060,31 @@ func TestPodToleratesTaints(t *testing.T) {
test
:
"The pod has a toleration that key and value don't match the taint on the node, "
+
"but the effect of taint on node is PreferNochedule. Pod can be scheduled onto the node"
,
},
{
pod
:
&
v1
.
Pod
{
ObjectMeta
:
v1
.
ObjectMeta
{
Name
:
"pod2"
,
},
Spec
:
v1
.
PodSpec
{
Containers
:
[]
v1
.
Container
{{
Image
:
"pod2:V1"
}},
},
},
node
:
v1
.
Node
{
ObjectMeta
:
v1
.
ObjectMeta
{
Annotations
:
map
[
string
]
string
{
v1
.
TaintsAnnotationKey
:
`
[{
"key": "dedicated",
"value": "user1",
"effect": "PreferNoSchedule"
}]`
,
},
},
},
fits
:
true
,
test
:
"The pod has no toleration, "
+
"but the effect of taint on node is PreferNochedule. Pod can be scheduled onto the node"
,
},
}
expectedFailureReasons
:=
[]
algorithm
.
PredicateFailureReason
{
ErrTaintsTolerationsNotMatch
}
...
...
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