Merge pull request #24743 from pmorie/kill-pod-errs

Clearly identify errors killing pods in events and logs
This commit is contained in:
Mike Danese
2016-05-20 16:38:51 -07:00

View File

@@ -1787,14 +1787,13 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
kl.statusManager.SetPodStatus(pod, apiPodStatus)
// Kill pod if it should not be running
if err := canRunPod(pod); err != nil || pod.DeletionTimestamp != nil || apiPodStatus.Phase == api.PodFailed {
if err := kl.killPod(pod, nil, podStatus, nil); err != nil {
// there was an error killing the pod, so we return that error directly
utilruntime.HandleError(err)
return err
if errOuter := canRunPod(pod); errOuter != nil || pod.DeletionTimestamp != nil || apiPodStatus.Phase == api.PodFailed {
if errInner := kl.killPod(pod, nil, podStatus, nil); errInner != nil {
errOuter = fmt.Errorf("error killing pod: %v", errInner)
utilruntime.HandleError(errOuter)
}
// there was no error killing the pod, but the pod cannot be run, so we return that err (if any)
return err
return errOuter
}
// Create Mirror Pod for Static Pod if it doesn't already exist