Add debug info: scheduler extenders's score and its name for each pod

pull/58/head
Jun Gong 2018-11-08 10:31:03 +08:00
parent 16d0992534
commit 9fc369dd0d
5 changed files with 20 additions and 1 deletions

View File

@ -26,6 +26,9 @@ import (
// decisions made by Kubernetes. This is typically needed for resources not directly
// managed by Kubernetes.
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
// expected to be a subset of the supplied list. failedNodesMap optionally contains
// the list of failed nodes and failure reasons.

View File

@ -107,6 +107,11 @@ func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerEx
}, 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
// is unavailable
func (h *HTTPExtender) IsIgnorable() bool {

View File

@ -120,6 +120,10 @@ type FakeExtender struct {
cachedNodeNameToInfo map[string]*schedulercache.NodeInfo
}
func (f *FakeExtender) Name() string {
return "FakeExtender"
}
func (f *FakeExtender) IsIgnorable() bool {
return f.ignorable
}

View File

@ -692,7 +692,7 @@ func PrioritizeNodes(
}
if glog.V(10) {
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)
@ -730,6 +730,9 @@ func PrioritizeNodes(
mu.Lock()
for i := range *prioritizedList {
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
}
mu.Unlock()

View File

@ -532,6 +532,10 @@ type fakeExtender struct {
ignorable bool
}
func (f *fakeExtender) Name() string {
return "fakeExtender"
}
func (f *fakeExtender) IsIgnorable() bool {
return f.ignorable
}