mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Check for sandboxes before deleting the pod from apiserver
This commit is contained in:
@@ -969,6 +969,16 @@ func (kl *Kubelet) PodResourcesAreReclaimed(pod *v1.Pod, status v1.PodStatus) bo
|
||||
klog.V(3).Infof("Pod %q is terminated, but some containers have not been cleaned up: %s", format.Pod(pod), statusStr)
|
||||
return false
|
||||
}
|
||||
// pod's sandboxes should be deleted
|
||||
if len(runtimeStatus.SandboxStatuses) > 0 {
|
||||
var sandboxStr string
|
||||
for _, sandbox := range runtimeStatus.SandboxStatuses {
|
||||
sandboxStr += fmt.Sprintf("%+v ", *sandbox)
|
||||
}
|
||||
klog.V(3).Infof("Pod %q is terminated, but some pod sandboxes have not been cleaned up: %s", format.Pod(pod), sandboxStr)
|
||||
return false
|
||||
}
|
||||
|
||||
if kl.podVolumesExist(pod.UID) && !kl.keepTerminatedPodVolumes {
|
||||
// We shouldn't delete pods whose volumes have not been cleaned up if we are not keeping terminated pod volumes
|
||||
klog.V(3).Infof("Pod %q is terminated, but some volumes have not been cleaned up", format.Pod(pod))
|
||||
|
||||
Reference in New Issue
Block a user