Merge pull request #106901 from bobbypage/graceful-shutdown-fix-master

kubelet: set failed phase during graceful shutdown
This commit is contained in:
Kubernetes Prow Robot 2021-12-09 14:39:04 -08:00 committed by GitHub
commit 747f3c8fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -316,6 +316,10 @@ func (m *managerImpl) processShutdownEvent() error {
klog.V(1).InfoS("Shutdown manager killing pod with gracePeriod", "pod", klog.KObj(pod), "gracePeriod", gracePeriodOverride)
if err := m.killPodFunc(pod, false, &gracePeriodOverride, func(status *v1.PodStatus) {
// set the pod status to failed (unless it was already in a successful terminal phase)
if status.Phase != v1.PodSucceeded {
status.Phase = v1.PodFailed
}
status.Message = nodeShutdownMessage
status.Reason = nodeShutdownReason
}); err != nil {

View File

@ -510,5 +510,5 @@ func isPodShutdown(pod *v1.Pod) bool {
}
}
return pod.Status.Message == podShutdownMessage && pod.Status.Reason == podShutdownReason && hasContainersNotReadyCondition
return pod.Status.Message == podShutdownMessage && pod.Status.Reason == podShutdownReason && hasContainersNotReadyCondition && pod.Status.Phase == v1.PodFailed
}