Migrate pkg/scheduler logs to structured logging

in pkg/scheduler/eventhandlers.go
  * add event for unscheduled pod
  * delete event for unscheduled pod
  * add event for scheduled pod
  * delete event for scheduled pod

in pkg/scheduler/framework/plugins/defaultbinder/default_binder.go
  * Attempting to bind pod to node

in pkg/scheduler/scheduler.go
  * Updating pod condition
  * Attempting to schedule pod
  * Skip schedule deleting pod
This commit is contained in:
Alex Dudko
2020-12-16 08:24:25 -08:00
parent 4164818517
commit c03b4c7850
3 changed files with 8 additions and 8 deletions

View File

@@ -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
}