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
d1fd1d35
Commit
d1fd1d35
authored
Dec 05, 2016
by
tanshanshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix comment and so on
parent
b0b6f3c2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
topologies.go
plugin/pkg/scheduler/algorithm/priorities/util/topologies.go
+1
-1
plugins.go
plugin/pkg/scheduler/factory/plugins.go
+11
-12
No files found.
plugin/pkg/scheduler/algorithm/priorities/util/topologies.go
View file @
d1fd1d35
...
...
@@ -59,7 +59,7 @@ type Topologies struct {
}
// NodesHaveSameTopologyKey checks if nodeA and nodeB have same label value with given topologyKey as label key.
// If the topologyKey is
nil/
empty, check if the two nodes have any of the default topologyKeys, and have same corresponding label value.
// If the topologyKey is empty, check if the two nodes have any of the default topologyKeys, and have same corresponding label value.
func
(
tps
*
Topologies
)
NodesHaveSameTopologyKey
(
nodeA
,
nodeB
*
v1
.
Node
,
topologyKey
string
)
bool
{
if
len
(
topologyKey
)
==
0
{
// assumes this is allowed only for PreferredDuringScheduling pod anti-affinity (ensured by api/validation)
...
...
plugin/pkg/scheduler/factory/plugins.go
View file @
d1fd1d35
...
...
@@ -82,7 +82,7 @@ var (
predicateMetadataProducer
MetadataProducerFactory
// get equivalence pod function
getEquivalencePodFunc
algorithm
.
GetEquivalencePodFunc
=
nil
getEquivalencePodFunc
algorithm
.
GetEquivalencePodFunc
)
const
(
...
...
@@ -110,7 +110,7 @@ func RegisterFitPredicateFactory(name string, predicateFactory FitPredicateFacto
return
name
}
// Registers a custom fit predicate with the algorithm registry.
// Register
CustomFitPredicate register
s a custom fit predicate with the algorithm registry.
// Returns the name, with which the predicate was registered.
func
RegisterCustomFitPredicate
(
policy
schedulerapi
.
PredicatePolicy
)
string
{
var
predicateFactory
FitPredicateFactory
...
...
@@ -154,7 +154,7 @@ func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string {
return
RegisterFitPredicateFactory
(
policy
.
Name
,
predicateFactory
)
}
//
This check
is useful for testing providers.
//
IsFitPredicateRegistered
is useful for testing providers.
func
IsFitPredicateRegistered
(
name
string
)
bool
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
...
...
@@ -187,7 +187,7 @@ func RegisterPriorityFunction(name string, function algorithm.PriorityFunction,
})
}
// Registers a priority function with the algorithm registry. Returns the name,
// Register
PriorityFunction2 register
s a priority function with the algorithm registry. Returns the name,
// with which the function was registered.
// FIXME: Rename to PriorityFunctionFactory.
func
RegisterPriorityFunction2
(
...
...
@@ -211,7 +211,7 @@ func RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) strin
return
name
}
// Registers a custom priority function with the algorithm registry.
// Register
CustomPriorityFunction register
s a custom priority function with the algorithm registry.
// Returns the name, with which the priority function was registered.
func
RegisterCustomPriorityFunction
(
policy
schedulerapi
.
PriorityPolicy
)
string
{
var
pcf
*
PriorityConfigFactory
...
...
@@ -242,12 +242,12 @@ func RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string {
Weight
:
policy
.
Weight
,
}
}
}
else
if
existing
_p
cf
,
ok
:=
priorityFunctionMap
[
policy
.
Name
];
ok
{
}
else
if
existing
P
cf
,
ok
:=
priorityFunctionMap
[
policy
.
Name
];
ok
{
glog
.
V
(
2
)
.
Infof
(
"Priority type %s already registered, reusing."
,
policy
.
Name
)
// set/update the weight based on the policy
pcf
=
&
PriorityConfigFactory
{
Function
:
existing
_p
cf
.
Function
,
MapReduceFunction
:
existing
_p
cf
.
MapReduceFunction
,
Function
:
existing
P
cf
.
Function
,
MapReduceFunction
:
existing
P
cf
.
MapReduceFunction
,
Weight
:
policy
.
Weight
,
}
}
...
...
@@ -263,7 +263,7 @@ func RegisterGetEquivalencePodFunction(equivalenceFunc algorithm.GetEquivalenceP
getEquivalencePodFunc
=
equivalenceFunc
}
//
This check
is useful for testing providers.
//
IsPriorityFunctionRegistered
is useful for testing providers.
func
IsPriorityFunctionRegistered
(
name
string
)
bool
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
...
...
@@ -271,7 +271,7 @@ func IsPriorityFunctionRegistered(name string) bool {
return
ok
}
// Registers a new algorithm provider with the algorithm registry. This should
// Register
AlgorithmProvider register
s a new algorithm provider with the algorithm registry. This should
// be called from the init function in a provider plugin.
func
RegisterAlgorithmProvider
(
name
string
,
predicateKeys
,
priorityKeys
sets
.
String
)
string
{
schedulerFactoryMutex
.
Lock
()
...
...
@@ -284,12 +284,11 @@ func RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys sets.Str
return
name
}
//
This function
should not be used to modify providers. It is publicly visible for testing.
//
GetAlgorithmProvider
should not be used to modify providers. It is publicly visible for testing.
func
GetAlgorithmProvider
(
name
string
)
(
*
AlgorithmProviderConfig
,
error
)
{
schedulerFactoryMutex
.
Lock
()
defer
schedulerFactoryMutex
.
Unlock
()
var
provider
AlgorithmProviderConfig
provider
,
ok
:=
algorithmProviderMap
[
name
]
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"plugin %q has not been registered"
,
name
)
...
...
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