diff --git a/pkg/scheduler/eventhandlers.go b/pkg/scheduler/eventhandlers.go index f7736f1c3b0..3647b6bf61b 100755 --- a/pkg/scheduler/eventhandlers.go +++ b/pkg/scheduler/eventhandlers.go @@ -169,7 +169,7 @@ func (sched *Scheduler) onCSINodeUpdate(oldObj, newObj interface{}) { func (sched *Scheduler) addPodToSchedulingQueue(obj interface{}) { pod := obj.(*v1.Pod) - klog.V(3).Infof("add event for unscheduled pod %s/%s", pod.Namespace, pod.Name) + klog.V(3).InfoS("Add event for unscheduled pod", "pod", klog.KObj(pod)) if err := sched.SchedulingQueue.Add(pod); err != nil { utilruntime.HandleError(fmt.Errorf("unable to queue %T: %v", obj, err)) } @@ -206,7 +206,7 @@ func (sched *Scheduler) deletePodFromSchedulingQueue(obj interface{}) { utilruntime.HandleError(fmt.Errorf("unable to handle object in %T: %T", sched, obj)) return } - klog.V(3).Infof("delete event for unscheduled pod %s/%s", pod.Namespace, pod.Name) + klog.V(3).InfoS("Delete event for unscheduled pod", "pod", klog.KObj(pod)) if err := sched.SchedulingQueue.Delete(pod); err != nil { utilruntime.HandleError(fmt.Errorf("unable to dequeue %T: %v", obj, err)) } @@ -226,7 +226,7 @@ func (sched *Scheduler) addPodToCache(obj interface{}) { klog.Errorf("cannot convert to *v1.Pod: %v", obj) return } - klog.V(3).Infof("add event for scheduled pod %s/%s ", pod.Namespace, pod.Name) + klog.V(3).InfoS("Add event for scheduled pod", "pod", klog.KObj(pod)) if err := sched.SchedulerCache.AddPod(pod); err != nil { klog.Errorf("scheduler cache AddPod failed: %v", err) @@ -284,7 +284,7 @@ func (sched *Scheduler) deletePodFromCache(obj interface{}) { klog.Errorf("cannot convert to *v1.Pod: %v", t) return } - klog.V(3).Infof("delete event for scheduled pod %s/%s ", pod.Namespace, pod.Name) + klog.V(3).InfoS("Delete event for scheduled pod", "pod", klog.KObj(pod)) // NOTE: Updates must be written to scheduler cache before invalidating // equivalence cache, because we could snapshot equivalence cache after the // invalidation and then snapshot the cache itself. If the cache is diff --git a/pkg/scheduler/framework/plugins/defaultbinder/default_binder.go b/pkg/scheduler/framework/plugins/defaultbinder/default_binder.go index 76fdb304cb1..3e8b309139a 100644 --- a/pkg/scheduler/framework/plugins/defaultbinder/default_binder.go +++ b/pkg/scheduler/framework/plugins/defaultbinder/default_binder.go @@ -48,7 +48,7 @@ func (b DefaultBinder) Name() string { // Bind binds pods to nodes using the k8s client. func (b DefaultBinder) Bind(ctx context.Context, state *framework.CycleState, p *v1.Pod, nodeName string) *framework.Status { - klog.V(3).Infof("Attempting to bind %v/%v to %v", p.Namespace, p.Name, nodeName) + klog.V(3).InfoS("Attempting to bind pod to node", "pod", klog.KObj(p), "node", nodeName) binding := &v1.Binding{ ObjectMeta: metav1.ObjectMeta{Namespace: p.Namespace, Name: p.Name, UID: p.UID}, Target: v1.ObjectReference{Kind: "Node", Name: nodeName}, diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index bed7896c01c..fe578c5bb17 100755 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -340,7 +340,7 @@ func (sched *Scheduler) recordSchedulingFailure(fwk framework.Framework, podInfo } func updatePod(client clientset.Interface, pod *v1.Pod, condition *v1.PodCondition, nominatedNode string) error { - klog.V(3).Infof("Updating pod condition for %s/%s to (%s==%s, Reason=%s)", pod.Namespace, pod.Name, condition.Type, condition.Status, condition.Reason) + klog.V(3).InfoS("Updating pod condition", "pod", klog.KObj(pod), "conditionType", condition.Type, "conditionStatus", condition.Status, "conditionReason", condition.Reason) podCopy := pod.DeepCopy() // NominatedNodeName is updated only if we are trying to set it, and the value is // different from the existing one. @@ -442,7 +442,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) { return } - klog.V(3).Infof("Attempting to schedule pod: %v/%v", pod.Namespace, pod.Name) + klog.V(3).InfoS("Attempting to schedule pod", "pod", klog.KObj(pod)) // Synchronously attempt to find a fit for the pod. start := time.Now() @@ -621,7 +621,7 @@ func (sched *Scheduler) skipPodSchedule(fwk framework.Framework, pod *v1.Pod) bo // Case 1: pod is being deleted. if pod.DeletionTimestamp != nil { fwk.EventRecorder().Eventf(pod, nil, v1.EventTypeWarning, "FailedScheduling", "Scheduling", "skip schedule deleting pod: %v/%v", pod.Namespace, pod.Name) - klog.V(3).Infof("Skip schedule deleting pod: %v/%v", pod.Namespace, pod.Name) + klog.V(3).InfoS("Skip schedule deleting pod", "pod", klog.KObj(pod)) return true }