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
b0bd3ff1
Commit
b0bd3ff1
authored
May 07, 2016
by
David Oppenheimer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move inter-pod affinity predicate and priority functions from default to
non-default due to negative performance effects even when not using the feature.
parent
66005063
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
defaults.go
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+18
-18
scheduler_predicates.go
test/e2e/scheduler_predicates.go
+5
-5
No files found.
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
b0bd3ff1
...
@@ -93,6 +93,24 @@ func init() {
...
@@ -93,6 +93,24 @@ func init() {
factory
.
RegisterFitPredicate
(
"HostName"
,
predicates
.
PodFitsHost
)
factory
.
RegisterFitPredicate
(
"HostName"
,
predicates
.
PodFitsHost
)
// Fit is determined by node selector query.
// Fit is determined by node selector query.
factory
.
RegisterFitPredicate
(
"MatchNodeSelector"
,
predicates
.
PodSelectorMatches
)
factory
.
RegisterFitPredicate
(
"MatchNodeSelector"
,
predicates
.
PodSelectorMatches
)
// Fit is determined by inter-pod affinity.
factory
.
RegisterFitPredicateFactory
(
"MatchInterPodAffinity"
,
func
(
args
factory
.
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicates
.
NewPodAffinityPredicate
(
args
.
NodeInfo
,
args
.
PodLister
,
args
.
FailureDomains
)
},
)
//pods should be placed in the same topological domain (e.g. same node, same rack, same zone, same power domain, etc.)
//as some other pods, or, conversely, should not be placed in the same topological domain as some other pods.
factory
.
RegisterPriorityConfigFactory
(
"InterPodAffinityPriority"
,
factory
.
PriorityConfigFactory
{
Function
:
func
(
args
factory
.
PluginFactoryArgs
)
algorithm
.
PriorityFunction
{
return
priorities
.
NewInterPodAffinityPriority
(
args
.
NodeInfo
,
args
.
NodeLister
,
args
.
PodLister
,
args
.
HardPodAffinitySymmetricWeight
,
args
.
FailureDomains
)
},
Weight
:
1
,
},
)
}
}
func
defaultPredicates
()
sets
.
String
{
func
defaultPredicates
()
sets
.
String
{
...
@@ -127,13 +145,6 @@ func defaultPredicates() sets.String {
...
@@ -127,13 +145,6 @@ func defaultPredicates() sets.String {
// GeneralPredicates are the predicates that are enforced by all Kubernetes components
// GeneralPredicates are the predicates that are enforced by all Kubernetes components
// (e.g. kubelet and all schedulers)
// (e.g. kubelet and all schedulers)
factory
.
RegisterFitPredicate
(
"GeneralPredicates"
,
predicates
.
GeneralPredicates
),
factory
.
RegisterFitPredicate
(
"GeneralPredicates"
,
predicates
.
GeneralPredicates
),
// Fit is determined by inter-pod affinity.
factory
.
RegisterFitPredicateFactory
(
"MatchInterPodAffinity"
,
func
(
args
factory
.
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicates
.
NewPodAffinityPredicate
(
args
.
NodeInfo
,
args
.
PodLister
,
args
.
FailureDomains
)
},
),
)
)
}
}
...
@@ -162,16 +173,5 @@ func defaultPriorities() sets.String {
...
@@ -162,16 +173,5 @@ func defaultPriorities() sets.String {
Weight
:
1
,
Weight
:
1
,
},
},
),
),
//pods should be placed in the same topological domain (e.g. same node, same rack, same zone, same power domain, etc.)
//as some other pods, or, conversely, should not be placed in the same topological domain as some other pods.
factory
.
RegisterPriorityConfigFactory
(
"InterPodAffinityPriority"
,
factory
.
PriorityConfigFactory
{
Function
:
func
(
args
factory
.
PluginFactoryArgs
)
algorithm
.
PriorityFunction
{
return
priorities
.
NewInterPodAffinityPriority
(
args
.
NodeInfo
,
args
.
NodeLister
,
args
.
PodLister
,
args
.
HardPodAffinitySymmetricWeight
,
args
.
FailureDomains
)
},
Weight
:
1
,
},
),
)
)
}
}
test/e2e/scheduler_predicates.go
View file @
b0bd3ff1
...
@@ -783,7 +783,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -783,7 +783,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})
})
// Test Nodes does not have any pod, hence it should be impossible to schedule a Pod with pod affinity.
// Test Nodes does not have any pod, hence it should be impossible to schedule a Pod with pod affinity.
It
(
"validates that Inter-pod-Affinity is respected if not matching"
,
func
()
{
It
(
"validates that Inter-pod-Affinity is respected if not matching
[Feature:PodAffinity]
"
,
func
()
{
By
(
"Trying to schedule Pod with nonempty Pod Affinity."
)
By
(
"Trying to schedule Pod with nonempty Pod Affinity."
)
podName
:=
"without-label-"
+
string
(
util
.
NewUUID
())
podName
:=
"without-label-"
+
string
(
util
.
NewUUID
())
...
@@ -831,7 +831,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -831,7 +831,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})
})
// test the pod affinity successful matching scenario.
// test the pod affinity successful matching scenario.
It
(
"validates that InterPodAffinity is respected if matching"
,
func
()
{
It
(
"validates that InterPodAffinity is respected if matching
[Feature:PodAffinity]
"
,
func
()
{
// launch a pod to find a node which can launch a pod. We intentionally do
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
// cluster and the scheduler it might be that a "normal" pod cannot be
...
@@ -923,7 +923,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -923,7 +923,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})
})
// test when the pod anti affinity rule is not satisfied, the pod would stay pending.
// test when the pod anti affinity rule is not satisfied, the pod would stay pending.
It
(
"validates that InterPodAntiAffinity is respected if matching"
,
func
()
{
It
(
"validates that InterPodAntiAffinity is respected if matching
2 [Feature:PodAffinity]
"
,
func
()
{
// launch a pod to find a node which can launch a pod. We intentionally do
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
// cluster and the scheduler it might be that a "normal" pod cannot be
...
@@ -1011,7 +1011,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -1011,7 +1011,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})
})
// test the pod affinity successful matching scenario with multiple Label Operators.
// test the pod affinity successful matching scenario with multiple Label Operators.
It
(
"validates that InterPodAffinity is respected if matching with multiple Affinities"
,
func
()
{
It
(
"validates that InterPodAffinity is respected if matching with multiple Affinities
[Feature:PodAffinity]
"
,
func
()
{
// launch a pod to find a node which can launch a pod. We intentionally do
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
// cluster and the scheduler it might be that a "normal" pod cannot be
...
@@ -1111,7 +1111,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -1111,7 +1111,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
})
})
// test the pod affinity and anti affinity successful matching scenario.
// test the pod affinity and anti affinity successful matching scenario.
It
(
"validates that InterPod Affinity and AntiAffinity is respected if matching"
,
func
()
{
It
(
"validates that InterPod Affinity and AntiAffinity is respected if matching
[Feature:PodAffinity]
"
,
func
()
{
// launch a pod to find a node which can launch a pod. We intentionally do
// launch a pod to find a node which can launch a pod. We intentionally do
// not just take the node list and choose the first of them. Depending on the
// not just take the node list and choose the first of them. Depending on the
// cluster and the scheduler it might be that a "normal" pod cannot be
// cluster and the scheduler it might be that a "normal" pod cannot be
...
...
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