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
dac59e4d
Commit
dac59e4d
authored
Feb 25, 2018
by
Da K. Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unschedulabe predicate.
Signed-off-by:
Da K. Ma
<
madaxa@cn.ibm.com
>
parent
af58729c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
predicates.go
pkg/scheduler/algorithm/predicates/predicates.go
+14
-3
defaults.go
pkg/scheduler/algorithmprovider/defaults/defaults.go
+4
-1
No files found.
pkg/scheduler/algorithm/predicates/predicates.go
View file @
dac59e4d
...
@@ -68,6 +68,8 @@ const (
...
@@ -68,6 +68,8 @@ const (
NoDiskConflictPred
=
"NoDiskConflict"
NoDiskConflictPred
=
"NoDiskConflict"
// PodToleratesNodeTaintsPred defines the name of predicate PodToleratesNodeTaints.
// PodToleratesNodeTaintsPred defines the name of predicate PodToleratesNodeTaints.
PodToleratesNodeTaintsPred
=
"PodToleratesNodeTaints"
PodToleratesNodeTaintsPred
=
"PodToleratesNodeTaints"
// CheckNodeUnschedulablePred defines the name of predicate CheckNodeUnschedulablePredicate.
CheckNodeUnschedulablePred
=
"CheckNodeUnschedulable"
// PodToleratesNodeNoExecuteTaintsPred defines the name of predicate PodToleratesNodeNoExecuteTaints.
// PodToleratesNodeNoExecuteTaintsPred defines the name of predicate PodToleratesNodeNoExecuteTaints.
PodToleratesNodeNoExecuteTaintsPred
=
"PodToleratesNodeNoExecuteTaints"
PodToleratesNodeNoExecuteTaintsPred
=
"PodToleratesNodeNoExecuteTaints"
// CheckNodeLabelPresencePred defines the name of predicate CheckNodeLabelPresence.
// CheckNodeLabelPresencePred defines the name of predicate CheckNodeLabelPresence.
...
@@ -124,7 +126,7 @@ const (
...
@@ -124,7 +126,7 @@ const (
// The order is based on the restrictiveness & complexity of predicates.
// The order is based on the restrictiveness & complexity of predicates.
// Design doc: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/predicates-ordering.md
// Design doc: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/predicates-ordering.md
var
(
var
(
predicatesOrdering
=
[]
string
{
CheckNodeConditionPred
,
predicatesOrdering
=
[]
string
{
CheckNodeConditionPred
,
CheckNodeUnschedulablePred
,
GeneralPred
,
HostNamePred
,
PodFitsHostPortsPred
,
GeneralPred
,
HostNamePred
,
PodFitsHostPortsPred
,
MatchNodeSelectorPred
,
PodFitsResourcesPred
,
NoDiskConflictPred
,
MatchNodeSelectorPred
,
PodFitsResourcesPred
,
NoDiskConflictPred
,
PodToleratesNodeTaintsPred
,
PodToleratesNodeNoExecuteTaintsPred
,
CheckNodeLabelPresencePred
,
PodToleratesNodeTaintsPred
,
PodToleratesNodeNoExecuteTaintsPred
,
CheckNodeLabelPresencePred
,
...
@@ -1432,8 +1434,8 @@ func (c *PodAffinityChecker) satisfiesPodsAffinityAntiAffinity(pod *v1.Pod, node
...
@@ -1432,8 +1434,8 @@ func (c *PodAffinityChecker) satisfiesPodsAffinityAntiAffinity(pod *v1.Pod, node
return
nil
,
nil
return
nil
,
nil
}
}
//
PodToleratesNodeTaints checks if a pod tolerations can tolerate the node taints
//
CheckNodeUnschedulablePredicate checks if a pod can be scheduled on a node with Unschedulable spec.
func
PodToleratesNodeTaints
(
pod
*
v1
.
Pod
,
meta
algorithm
.
PredicateMetadata
,
nodeInfo
*
schedulercache
.
NodeInfo
)
(
bool
,
[]
algorithm
.
PredicateFailureReason
,
error
)
{
func
CheckNodeUnschedulablePredicate
(
pod
*
v1
.
Pod
,
meta
algorithm
.
PredicateMetadata
,
nodeInfo
*
schedulercache
.
NodeInfo
)
(
bool
,
[]
algorithm
.
PredicateFailureReason
,
error
)
{
if
nodeInfo
==
nil
||
nodeInfo
.
Node
()
==
nil
{
if
nodeInfo
==
nil
||
nodeInfo
.
Node
()
==
nil
{
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrNodeUnknownCondition
},
nil
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrNodeUnknownCondition
},
nil
}
}
...
@@ -1442,6 +1444,15 @@ func PodToleratesNodeTaints(pod *v1.Pod, meta algorithm.PredicateMetadata, nodeI
...
@@ -1442,6 +1444,15 @@ func PodToleratesNodeTaints(pod *v1.Pod, meta algorithm.PredicateMetadata, nodeI
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrNodeUnschedulable
},
nil
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrNodeUnschedulable
},
nil
}
}
return
true
,
nil
,
nil
}
// PodToleratesNodeTaints checks if a pod tolerations can tolerate the node taints
func
PodToleratesNodeTaints
(
pod
*
v1
.
Pod
,
meta
algorithm
.
PredicateMetadata
,
nodeInfo
*
schedulercache
.
NodeInfo
)
(
bool
,
[]
algorithm
.
PredicateFailureReason
,
error
)
{
if
nodeInfo
==
nil
||
nodeInfo
.
Node
()
==
nil
{
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrNodeUnknownCondition
},
nil
}
return
podToleratesNodeTaints
(
pod
,
nodeInfo
,
func
(
t
*
v1
.
Taint
)
bool
{
return
podToleratesNodeTaints
(
pod
,
nodeInfo
,
func
(
t
*
v1
.
Taint
)
bool
{
// PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints.
// PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints.
return
t
.
Effect
==
v1
.
TaintEffectNoSchedule
||
t
.
Effect
==
v1
.
TaintEffectNoExecute
return
t
.
Effect
==
v1
.
TaintEffectNoSchedule
||
t
.
Effect
==
v1
.
TaintEffectNoExecute
...
...
pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
dac59e4d
...
@@ -186,12 +186,15 @@ func ApplyFeatureGates() {
...
@@ -186,12 +186,15 @@ func ApplyFeatureGates() {
// if you just want remove specific provider, call func RemovePredicateKeyFromAlgoProvider()
// if you just want remove specific provider, call func RemovePredicateKeyFromAlgoProvider()
factory
.
RemovePredicateKeyFromAlgorithmProviderMap
(
predicates
.
CheckNodeConditionPred
)
factory
.
RemovePredicateKeyFromAlgorithmProviderMap
(
predicates
.
CheckNodeConditionPred
)
// Fit is determined based on whether a node has Unschedulable spec
factory
.
RegisterMandatoryFitPredicate
(
predicates
.
CheckNodeUnschedulablePred
,
predicates
.
CheckNodeUnschedulablePredicate
)
// Fit is determined based on whether a pod can tolerate all of the node's taints
// Fit is determined based on whether a pod can tolerate all of the node's taints
factory
.
RegisterMandatoryFitPredicate
(
predicates
.
PodToleratesNodeTaintsPred
,
predicates
.
PodToleratesNodeTaints
)
factory
.
RegisterMandatoryFitPredicate
(
predicates
.
PodToleratesNodeTaintsPred
,
predicates
.
PodToleratesNodeTaints
)
// Insert Key "PodToleratesNodeTaints" To All Algorithm Provider
// Insert Key "PodToleratesNodeTaints"
and "CheckNodeUnschedulable"
To All Algorithm Provider
// The key will insert to all providers which in algorithmProviderMap[]
// The key will insert to all providers which in algorithmProviderMap[]
// if you just want insert to specific provider, call func InsertPredicateKeyToAlgoProvider()
// if you just want insert to specific provider, call func InsertPredicateKeyToAlgoProvider()
factory
.
InsertPredicateKeyToAlgorithmProviderMap
(
predicates
.
PodToleratesNodeTaintsPred
)
factory
.
InsertPredicateKeyToAlgorithmProviderMap
(
predicates
.
PodToleratesNodeTaintsPred
)
factory
.
InsertPredicateKeyToAlgorithmProviderMap
(
predicates
.
CheckNodeUnschedulablePred
)
glog
.
Warningf
(
"TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory"
)
glog
.
Warningf
(
"TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory"
)
}
}
...
...
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