Skip to content

Commit

Permalink
Merge pull request kubernetes#10642 from davidopp/clean
Browse files Browse the repository at this point in the history
Clarify and make less verbose event message for infeasible pods.
  • Loading branch information
yujuhong committed Jul 6, 2015
2 parents 1817f74 + 950ab8f commit ea16e52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions plugin/pkg/scheduler/generic_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion plugin/pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ea16e52

Please sign in to comment.