mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Clearly identify errors killing pods in events and logs
This commit is contained in:
parent
f538d6019d
commit
451c7f28b2
@ -1789,14 +1789,13 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
|
|||||||
kl.statusManager.SetPodStatus(pod, apiPodStatus)
|
kl.statusManager.SetPodStatus(pod, apiPodStatus)
|
||||||
|
|
||||||
// Kill pod if it should not be running
|
// Kill pod if it should not be running
|
||||||
if err := canRunPod(pod); err != nil || pod.DeletionTimestamp != nil || apiPodStatus.Phase == api.PodFailed {
|
if errOuter := canRunPod(pod); errOuter != nil || pod.DeletionTimestamp != nil || apiPodStatus.Phase == api.PodFailed {
|
||||||
if err := kl.killPod(pod, nil, podStatus, nil); err != nil {
|
if errInner := kl.killPod(pod, nil, podStatus, nil); errInner != nil {
|
||||||
// there was an error killing the pod, so we return that error directly
|
errOuter = fmt.Errorf("error killing pod: %v", errInner)
|
||||||
utilruntime.HandleError(err)
|
utilruntime.HandleError(errOuter)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
// there was no error killing the pod, but the pod cannot be run, so we return that err (if any)
|
// 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
|
// Create Mirror Pod for Static Pod if it doesn't already exist
|
||||||
|
Loading…
Reference in New Issue
Block a user