Merge pull request #30676 from m1093782566/improve-pod-log-output-format

Automatic merge from submit-queue

[Scheduler] Improve pod log output debuggability

Address issue is #30675

The result of my expirments shows that both `glog.Infof("%v", pod)` and `glog.Infof("%+v", pod)` can't output useful information of a pod, it can only output `kind:"" apiVersion:""`. 

`%#v` can output the whole content of pod, but it seems too much!

So, my opinion is output pod info use the format of `%v` to print`pod.Namespace/pod.Name` instead of the pod **object** in both [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/scheduler.go#L96) and [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/scheduler.go#L100).

@wojtek-t
This commit is contained in:
Kubernetes Submit Queue 2016-08-25 04:05:24 -07:00 committed by GitHub
commit d12b3429fe

View File

@ -93,11 +93,11 @@ func (s *Scheduler) Run() {
func (s *Scheduler) scheduleOne() {
pod := s.config.NextPod()
glog.V(3).Infof("Attempting to schedule: %+v", pod)
glog.V(3).Infof("Attempting to schedule pod: %v/%v", pod.Namespace, pod.Name)
start := time.Now()
dest, err := s.config.Algorithm.Schedule(pod, s.config.NodeLister)
if err != nil {
glog.V(1).Infof("Failed to schedule: %+v", pod)
glog.V(1).Infof("Failed to schedule pod: %v/%v", pod.Namespace, pod.Name)
s.config.Error(pod, err)
s.config.Recorder.Eventf(pod, api.EventTypeWarning, "FailedScheduling", "%v", err)
s.config.PodConditionUpdater.Update(pod, &api.PodCondition{