Merge pull request #80736 from cofyc/log-error-when-api-requst-fails

Log an error when kube-scheduler fails to update the condition of the pod
This commit is contained in:
Kubernetes Prow Robot 2019-07-31 13:48:15 -07:00 committed by GitHub
commit fc46a2f59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,