mirror of https://github.com/k3s-io/k3s
Add debug info: scheduler extenders's score and its name for each pod
parent
16d0992534
commit
9fc369dd0d
|
@ -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.
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
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()
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue