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
4a32bde4
Commit
4a32bde4
authored
Aug 14, 2017
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RegisterMandatoryFitPredicate to avoid double register.
parent
2820b45c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
defaults.go
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+0
-1
plugins.go
plugin/pkg/scheduler/factory/plugins.go
+12
-9
No files found.
plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
4a32bde4
...
...
@@ -176,7 +176,6 @@ func defaultPredicates() sets.String {
factory
.
RegisterFitPredicate
(
"CheckNodeDiskPressure"
,
predicates
.
CheckNodeDiskPressurePredicate
),
// Fit is determied by node condtions: not ready, network unavailable and out of disk.
factory
.
RegisterFitPredicate
(
"CheckNodeCondition"
,
predicates
.
CheckNodeConditionPredicate
),
factory
.
RegisterMandatoryFitPredicate
(
"CheckNodeCondition"
,
predicates
.
CheckNodeConditionPredicate
),
// Fit is determined by volume zone requirements.
...
...
plugin/pkg/scheduler/factory/plugins.go
View file @
4a32bde4
...
...
@@ -72,10 +72,10 @@ var (
schedulerFactoryMutex
sync
.
Mutex
// maps that hold registered algorithm types
fitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
mandatoryFitPredicate
Map
=
make
(
map
[
string
]
FitPredicateFactory
)
priorityFunctionMap
=
make
(
map
[
string
]
PriorityConfigFactory
)
algorithmProviderMap
=
make
(
map
[
string
]
AlgorithmProviderConfig
)
fitPredicateMap
=
make
(
map
[
string
]
FitPredicateFactory
)
mandatoryFitPredicate
s
=
make
(
map
[
string
]
bool
)
priorityFunctionMap
=
make
(
map
[
string
]
PriorityConfigFactory
)
algorithmProviderMap
=
make
(
map
[
string
]
AlgorithmProviderConfig
)
// Registered metadata producers
priorityMetadataProducer
MetadataProducerFactory
...
...
@@ -107,7 +107,8 @@ func RegisterMandatoryFitPredicate(name string, predicate algorithm.FitPredicate
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
validateAlgorithmNameOrDie
(
name
)
mandatoryFitPredicateMap
[
name
]
=
func
(
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicate
}
fitPredicateMap
[
name
]
=
func
(
PluginFactoryArgs
)
algorithm
.
FitPredicate
{
return
predicate
}
mandatoryFitPredicates
[
name
]
=
true
return
name
}
...
...
@@ -321,10 +322,12 @@ func getFitPredicateFunctions(names sets.String, args PluginFactoryArgs) (map[st
predicates
[
name
]
=
factory
(
args
)
}
// Always include required fit predicates.
for
name
,
factory
:=
range
mandatoryFitPredicateMap
{
if
_
,
found
:=
predicates
[
name
];
!
found
{
predicates
[
name
]
=
factory
(
args
)
// Always include mandatory fit predicates.
for
name
,
mandatory
:=
range
mandatoryFitPredicates
{
if
mandatory
{
if
factory
,
found
:=
fitPredicateMap
[
name
];
found
{
predicates
[
name
]
=
factory
(
args
)
}
}
}
...
...
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