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
78e07839
Commit
78e07839
authored
Aug 12, 2017
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed to RegisterMandatoryFitPredicate.
parent
e9738c0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
defaults.go
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+1
-1
plugins.go
plugin/pkg/scheduler/factory/plugins.go
+5
-5
scheduler_test.go
test/integration/scheduler/scheduler_test.go
+1
-1
No files found.
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
78e07839
...
...
@@ -177,7 +177,7 @@ func defaultPredicates() sets.String {
// Fit is determied by node condtions: not ready, network unavailable and out of disk.
factory
.
RegisterFitPredicate
(
"CheckNodeCondition"
,
predicates
.
CheckNodeConditionPredicate
),
factory
.
Register
Essential
FitPredicate
(
"CheckNodeCondition"
,
predicates
.
CheckNodeConditionPredicate
),
factory
.
Register
Mandatory
FitPredicate
(
"CheckNodeCondition"
,
predicates
.
CheckNodeConditionPredicate
),
// Fit is determined by volume zone requirements.
factory
.
RegisterFitPredicateFactory
(
...
...
plugin/pkg/scheduler/factory/plugins.go
View file @
78e07839
...
...
@@ -73,7 +73,7 @@ var (
// maps that hold registered algorithm types
fitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
essential
FitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
mandatory
FitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
priorityFunctionMap
=
make
(
map
[
string
]
PriorityConfigFactory
)
algorithmProviderMap
=
make
(
map
[
string
]
AlgorithmProviderConfig
)
...
...
@@ -100,14 +100,14 @@ func RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string
return
RegisterFitPredicateFactory
(
name
,
func
(
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicate
})
}
// Register
Essential
FitPredicate registers a fit predicate with the algorithm registry, the predicate is used by
// Register
Mandatory
FitPredicate registers a fit predicate with the algorithm registry, the predicate is used by
// kubelet, DaemonSet; it is always included in configuration. Returns the name with which the predicate was
// registered.
func
Register
Essential
FitPredicate
(
name
string
,
predicate
algorithm
.
FitPredicate
)
string
{
func
Register
Mandatory
FitPredicate
(
name
string
,
predicate
algorithm
.
FitPredicate
)
string
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
validateAlgorithmNameOrDie
(
name
)
essential
FitPredicateMap
[
name
]
=
func
(
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicate
}
mandatory
FitPredicateMap
[
name
]
=
func
(
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicate
}
return
name
}
...
...
@@ -322,7 +322,7 @@ func getFitPredicateFunctions(names sets.String, args PluginFactoryArgs) (map[st
}
// Always include required fit predicates.
for
name
,
factory
:=
range
essential
FitPredicateMap
{
for
name
,
factory
:=
range
mandatory
FitPredicateMap
{
if
_
,
found
:=
predicates
[
name
];
!
found
{
predicates
[
name
]
=
factory
(
args
)
}
...
...
test/integration/scheduler/scheduler_test.go
View file @
78e07839
...
...
@@ -139,7 +139,7 @@ func TestSchedulerCreationFromConfigMap(t *testing.T) {
// Verify that the config is applied correctly.
schedPredicates
:=
sched
.
Config
()
.
Algorithm
.
Predicates
()
schedPrioritizers
:=
sched
.
Config
()
.
Algorithm
.
Prioritizers
()
// Includes one
essential
predicates.
// Includes one
mandatory
predicates.
if
len
(
schedPredicates
)
!=
3
||
len
(
schedPrioritizers
)
!=
2
{
t
.
Errorf
(
"Unexpected number of predicates or priority functions. Number of predicates: %v, number of prioritizers: %v"
,
len
(
schedPredicates
),
len
(
schedPrioritizers
))
}
...
...
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