Log an error when kube-scheduler fails to update the condition of the pod.

This commit is contained in:
Yecheng Fu 2019-07-30 09:55:21 +08:00
parent 1871f75b32
commit 00afede30d

View File

@ -272,12 +272,14 @@ func (sched *Scheduler) Config() *factory.Config {
func (sched *Scheduler) recordSchedulingFailure(pod *v1.Pod, err error, reason string, message string) {
sched.config.Error(pod, err)
sched.config.Recorder.Eventf(pod, nil, v1.EventTypeWarning, "FailedScheduling", "Scheduling", message)
sched.config.PodConditionUpdater.Update(pod, &v1.PodCondition{
if err := sched.config.PodConditionUpdater.Update(pod, &v1.PodCondition{
Type: v1.PodScheduled,
Status: v1.ConditionFalse,
Reason: reason,
Message: err.Error(),
})
}); err != nil {
klog.Errorf("Error updating the condition of the pod %s/%s: %v", pod.Namespace, pod.Name, err)
}
}
// schedule implements the scheduling algorithm and returns the suggested result(host,