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
55662f26
Commit
55662f26
authored
Apr 25, 2018
by
Jonathan Basseri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify logic in podFitsOnNode.
Use new (*EquivalenceCache).RunPredicate to simplify how we read and update the equivalence cache items.
parent
e67b3225
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
33 deletions
+5
-33
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+5
-33
No files found.
pkg/scheduler/core/generic_scheduler.go
View file @
55662f26
...
@@ -508,39 +508,11 @@ func podFitsOnNode(
...
@@ -508,39 +508,11 @@ func podFitsOnNode(
)
)
//TODO (yastij) : compute average predicate restrictiveness to export it as Prometheus metric
//TODO (yastij) : compute average predicate restrictiveness to export it as Prometheus metric
if
predicate
,
exist
:=
predicateFuncs
[
predicateKey
];
exist
{
if
predicate
,
exist
:=
predicateFuncs
[
predicateKey
];
exist
{
// Use an in-line function to guarantee invocation of ecache.Unlock()
if
eCacheAvailable
{
// when the in-line function returns.
fit
,
reasons
,
err
=
ecache
.
RunPredicate
(
predicate
,
predicateKey
,
pod
,
metaToUse
,
nodeInfoToUse
,
equivCacheInfo
,
cache
)
func
()
{
}
else
{
var
invalid
bool
fit
,
reasons
,
err
=
predicate
(
pod
,
metaToUse
,
nodeInfoToUse
)
if
eCacheAvailable
{
}
// Lock ecache here to avoid a race condition against cache invalidation invoked
// in event handlers. This race has existed despite locks in equivClassCacheimplementation.
ecache
.
Lock
()
defer
ecache
.
Unlock
()
// PredicateWithECache will return its cached predicate results.
fit
,
reasons
,
invalid
=
ecache
.
PredicateWithECache
(
pod
.
GetName
(),
info
.
Node
()
.
GetName
(),
predicateKey
,
equivCacheInfo
.
hash
,
false
)
}
if
!
eCacheAvailable
||
invalid
{
// we need to execute predicate functions since equivalence cache does not work
fit
,
reasons
,
err
=
predicate
(
pod
,
metaToUse
,
nodeInfoToUse
)
if
err
!=
nil
{
return
}
if
eCacheAvailable
{
// Skip update if NodeInfo is stale.
if
cache
!=
nil
&&
cache
.
IsUpToDate
(
info
)
{
ecache
.
UpdateCachedPredicateItem
(
pod
.
GetName
(),
info
.
Node
()
.
GetName
(),
predicateKey
,
fit
,
reasons
,
equivCacheInfo
.
hash
,
false
)
}
}
}
}()
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
[]
algorithm
.
PredicateFailureReason
{},
err
return
false
,
[]
algorithm
.
PredicateFailureReason
{},
err
}
}
...
...
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