mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Clarify and make less verbose event message for infeasible pods.
This commit is contained in:
parent
835eded294
commit
950ab8f219
@ -41,12 +41,15 @@ var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")
|
||||
|
||||
// implementation of the error interface
|
||||
func (f *FitError) Error() string {
|
||||
predicates := util.NewStringSet()
|
||||
var reason string
|
||||
// We iterate over all nodes for logging purposes, even though we only return one reason from one node
|
||||
for node, predicateList := range f.FailedPredicates {
|
||||
predicates = predicates.Union(predicateList)
|
||||
glog.Infof("failed to find fit for pod %v on node %s: %s", f.Pod.Name, node, strings.Join(predicateList.List(), ","))
|
||||
if len(reason) == 0 {
|
||||
reason, _ = predicateList.PopAny()
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("For each of these fitness predicates, pod %v failed on at least one node: %v.", f.Pod.Name, strings.Join(predicates.List(), ","))
|
||||
return fmt.Sprintf("Failed for reason %s and possibly others", reason)
|
||||
}
|
||||
|
||||
type genericScheduler struct {
|
||||
|
@ -125,7 +125,7 @@ func (s *Scheduler) scheduleOne() {
|
||||
metrics.SchedulingAlgorithmLatency.Observe(metrics.SinceInMicroseconds(start))
|
||||
if err != nil {
|
||||
glog.V(1).Infof("Failed to schedule: %v", pod)
|
||||
s.config.Recorder.Eventf(pod, "failedScheduling", "Error scheduling: %v", err)
|
||||
s.config.Recorder.Eventf(pod, "failedScheduling", "%v", err)
|
||||
s.config.Error(pod, err)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user