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
73a0083a
Commit
73a0083a
authored
Feb 02, 2017
by
Alexander Block
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scheduler predicate to filter for max Azure disks attached
parent
b3d627c2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
predicates.go
plugin/pkg/scheduler/algorithm/predicates/predicates.go
+17
-0
compatibility_test.go
...cheduler/algorithmprovider/defaults/compatibility_test.go
+6
-0
defaults.go
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+11
-0
No files found.
plugin/pkg/scheduler/algorithm/predicates/predicates.go
View file @
73a0083a
...
@@ -349,6 +349,23 @@ var GCEPDVolumeFilter VolumeFilter = VolumeFilter{
...
@@ -349,6 +349,23 @@ var GCEPDVolumeFilter VolumeFilter = VolumeFilter{
},
},
}
}
// AzureDiskVolumeFilter is a VolumeFilter for filtering Azure Disk Volumes
var
AzureDiskVolumeFilter
VolumeFilter
=
VolumeFilter
{
FilterVolume
:
func
(
vol
*
v1
.
Volume
)
(
string
,
bool
)
{
if
vol
.
AzureDisk
!=
nil
{
return
vol
.
AzureDisk
.
DiskName
,
true
}
return
""
,
false
},
FilterPersistentVolume
:
func
(
pv
*
v1
.
PersistentVolume
)
(
string
,
bool
)
{
if
pv
.
Spec
.
AzureDisk
!=
nil
{
return
pv
.
Spec
.
AzureDisk
.
DiskName
,
true
}
return
""
,
false
},
}
type
VolumeZoneChecker
struct
{
type
VolumeZoneChecker
struct
{
pvInfo
PersistentVolumeInfo
pvInfo
PersistentVolumeInfo
pvcInfo
PersistentVolumeClaimInfo
pvcInfo
PersistentVolumeClaimInfo
...
...
plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go
View file @
73a0083a
...
@@ -138,6 +138,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -138,6 +138,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{"name": "NoVolumeZoneConflict"},
{"name": "NoVolumeZoneConflict"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxAzureDiskVolumeCount"},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
{"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
{"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
],"priorities": [
],"priorities": [
...
@@ -161,6 +162,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -161,6 +162,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{
Name
:
"NoVolumeZoneConflict"
},
{
Name
:
"NoVolumeZoneConflict"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxAzureDiskVolumeCount"
},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
{
Name
:
"TestLabelsPresence"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
LabelsPresence
:
&
schedulerapi
.
LabelsPresence
{
Labels
:
[]
string
{
"foo"
},
Presence
:
true
}}},
{
Name
:
"TestLabelsPresence"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
LabelsPresence
:
&
schedulerapi
.
LabelsPresence
{
Labels
:
[]
string
{
"foo"
},
Presence
:
true
}}},
},
},
...
@@ -194,6 +196,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -194,6 +196,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{"name": "CheckNodeMemoryPressure"},
{"name": "CheckNodeMemoryPressure"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxAzureDiskVolumeCount"},
{"name": "MatchInterPodAffinity"},
{"name": "MatchInterPodAffinity"},
{"name": "GeneralPredicates"},
{"name": "GeneralPredicates"},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
...
@@ -221,6 +224,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -221,6 +224,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{
Name
:
"CheckNodeMemoryPressure"
},
{
Name
:
"CheckNodeMemoryPressure"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxAzureDiskVolumeCount"
},
{
Name
:
"MatchInterPodAffinity"
},
{
Name
:
"MatchInterPodAffinity"
},
{
Name
:
"GeneralPredicates"
},
{
Name
:
"GeneralPredicates"
},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
...
@@ -257,6 +261,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -257,6 +261,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{"name": "CheckNodeDiskPressure"},
{"name": "CheckNodeDiskPressure"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxEBSVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxGCEPDVolumeCount"},
{"name": "MaxAzureDiskVolumeCount"},
{"name": "MatchInterPodAffinity"},
{"name": "MatchInterPodAffinity"},
{"name": "GeneralPredicates"},
{"name": "GeneralPredicates"},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
{"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
...
@@ -287,6 +292,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
...
@@ -287,6 +292,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
{
Name
:
"CheckNodeDiskPressure"
},
{
Name
:
"CheckNodeDiskPressure"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxEBSVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxGCEPDVolumeCount"
},
{
Name
:
"MaxAzureDiskVolumeCount"
},
{
Name
:
"MatchInterPodAffinity"
},
{
Name
:
"MatchInterPodAffinity"
},
{
Name
:
"GeneralPredicates"
},
{
Name
:
"GeneralPredicates"
},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
{
Name
:
"TestServiceAffinity"
,
Argument
:
&
schedulerapi
.
PredicateArgument
{
ServiceAffinity
:
&
schedulerapi
.
ServiceAffinity
{
Labels
:
[]
string
{
"region"
}}}},
...
...
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
73a0083a
...
@@ -37,6 +37,8 @@ import (
...
@@ -37,6 +37,8 @@ import (
const
(
const
(
// GCE instances can have up to 16 PD volumes attached.
// GCE instances can have up to 16 PD volumes attached.
DefaultMaxGCEPDVolumes
=
16
DefaultMaxGCEPDVolumes
=
16
// Larger Azure VMs can actually have much more disks attached. TODO We should determine the max based on VM size
DefaultMaxAzureDiskVolumes
=
16
ClusterAutoscalerProvider
=
"ClusterAutoscalerProvider"
ClusterAutoscalerProvider
=
"ClusterAutoscalerProvider"
StatefulSetKind
=
"StatefulSet"
StatefulSetKind
=
"StatefulSet"
)
)
...
@@ -136,6 +138,15 @@ func defaultPredicates() sets.String {
...
@@ -136,6 +138,15 @@ func defaultPredicates() sets.String {
return
predicates
.
NewMaxPDVolumeCountPredicate
(
predicates
.
GCEPDVolumeFilter
,
maxVols
,
args
.
PVInfo
,
args
.
PVCInfo
)
return
predicates
.
NewMaxPDVolumeCountPredicate
(
predicates
.
GCEPDVolumeFilter
,
maxVols
,
args
.
PVInfo
,
args
.
PVCInfo
)
},
},
),
),
// Fit is determined by whether or not there would be too many Azure Disk volumes attached to the node
factory
.
RegisterFitPredicateFactory
(
"MaxAzureDiskVolumeCount"
,
func
(
args
factory
.
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
// TODO: allow for generically parameterized scheduler predicates, because this is a bit ugly
maxVols
:=
getMaxVols
(
DefaultMaxAzureDiskVolumes
)
return
predicates
.
NewMaxPDVolumeCountPredicate
(
predicates
.
AzureDiskVolumeFilter
,
maxVols
,
args
.
PVInfo
,
args
.
PVCInfo
)
},
),
// Fit is determined by inter-pod affinity.
// Fit is determined by inter-pod affinity.
factory
.
RegisterFitPredicateFactory
(
factory
.
RegisterFitPredicateFactory
(
"MatchInterPodAffinity"
,
"MatchInterPodAffinity"
,
...
...
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