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
9fc369dd
Commit
9fc369dd
authored
Nov 08, 2018
by
Jun Gong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug info: scheduler extenders's score and its name for each pod
parent
16d09925
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
1 deletion
+20
-1
scheduler_interface.go
pkg/scheduler/algorithm/scheduler_interface.go
+3
-0
extender.go
pkg/scheduler/core/extender.go
+5
-0
extender_test.go
pkg/scheduler/core/extender_test.go
+4
-0
generic_scheduler.go
pkg/scheduler/core/generic_scheduler.go
+4
-1
factory_test.go
pkg/scheduler/factory/factory_test.go
+4
-0
No files found.
pkg/scheduler/algorithm/scheduler_interface.go
View file @
9fc369dd
...
@@ -26,6 +26,9 @@ import (
...
@@ -26,6 +26,9 @@ import (
// decisions made by Kubernetes. This is typically needed for resources not directly
// decisions made by Kubernetes. This is typically needed for resources not directly
// managed by Kubernetes.
// managed by Kubernetes.
type
SchedulerExtender
interface
{
type
SchedulerExtender
interface
{
// Name returns a unique name that identifies the extender.
Name
()
string
// Filter based on extender-implemented predicate functions. The filtered list is
// Filter based on extender-implemented predicate functions. The filtered list is
// expected to be a subset of the supplied list. failedNodesMap optionally contains
// expected to be a subset of the supplied list. failedNodesMap optionally contains
// the list of failed nodes and failure reasons.
// the list of failed nodes and failure reasons.
...
...
pkg/scheduler/core/extender.go
View file @
9fc369dd
...
@@ -107,6 +107,11 @@ func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerEx
...
@@ -107,6 +107,11 @@ func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerEx
},
nil
},
nil
}
}
// Name returns extenderURL to identifies the extender.
func
(
h
*
HTTPExtender
)
Name
()
string
{
return
h
.
extenderURL
}
// IsIgnorable returns true indicates scheduling should not fail when this extender
// IsIgnorable returns true indicates scheduling should not fail when this extender
// is unavailable
// is unavailable
func
(
h
*
HTTPExtender
)
IsIgnorable
()
bool
{
func
(
h
*
HTTPExtender
)
IsIgnorable
()
bool
{
...
...
pkg/scheduler/core/extender_test.go
View file @
9fc369dd
...
@@ -120,6 +120,10 @@ type FakeExtender struct {
...
@@ -120,6 +120,10 @@ type FakeExtender struct {
cachedNodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
cachedNodeNameToInfo
map
[
string
]
*
schedulercache
.
NodeInfo
}
}
func
(
f
*
FakeExtender
)
Name
()
string
{
return
"FakeExtender"
}
func
(
f
*
FakeExtender
)
IsIgnorable
()
bool
{
func
(
f
*
FakeExtender
)
IsIgnorable
()
bool
{
return
f
.
ignorable
return
f
.
ignorable
}
}
...
...
pkg/scheduler/core/generic_scheduler.go
View file @
9fc369dd
...
@@ -692,7 +692,7 @@ func PrioritizeNodes(
...
@@ -692,7 +692,7 @@ func PrioritizeNodes(
}
}
if
glog
.
V
(
10
)
{
if
glog
.
V
(
10
)
{
for
_
,
hostPriority
:=
range
results
[
index
]
{
for
_
,
hostPriority
:=
range
results
[
index
]
{
glog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
pod
.
Name
,
hostPriority
.
Host
,
config
.
Name
,
hostPriority
.
Score
)
glog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
)
,
hostPriority
.
Host
,
config
.
Name
,
hostPriority
.
Score
)
}
}
}
}
}(
i
,
priorityConfig
)
}(
i
,
priorityConfig
)
...
@@ -730,6 +730,9 @@ func PrioritizeNodes(
...
@@ -730,6 +730,9 @@ func PrioritizeNodes(
mu
.
Lock
()
mu
.
Lock
()
for
i
:=
range
*
prioritizedList
{
for
i
:=
range
*
prioritizedList
{
host
,
score
:=
(
*
prioritizedList
)[
i
]
.
Host
,
(
*
prioritizedList
)[
i
]
.
Score
host
,
score
:=
(
*
prioritizedList
)[
i
]
.
Host
,
(
*
prioritizedList
)[
i
]
.
Score
if
glog
.
V
(
10
)
{
glog
.
Infof
(
"%v -> %v: %v, Score: (%d)"
,
util
.
GetPodFullName
(
pod
),
host
,
ext
.
Name
(),
score
)
}
combinedScores
[
host
]
+=
score
*
weight
combinedScores
[
host
]
+=
score
*
weight
}
}
mu
.
Unlock
()
mu
.
Unlock
()
...
...
pkg/scheduler/factory/factory_test.go
View file @
9fc369dd
...
@@ -532,6 +532,10 @@ type fakeExtender struct {
...
@@ -532,6 +532,10 @@ type fakeExtender struct {
ignorable
bool
ignorable
bool
}
}
func
(
f
*
fakeExtender
)
Name
()
string
{
return
"fakeExtender"
}
func
(
f
*
fakeExtender
)
IsIgnorable
()
bool
{
func
(
f
*
fakeExtender
)
IsIgnorable
()
bool
{
return
f
.
ignorable
return
f
.
ignorable
}
}
...
...
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