mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	remove containers of deleted pods once all containers have exited
This commit is contained in:
		@@ -2152,8 +2152,10 @@ func (kl *Kubelet) cleanUpContainersInPod(podID types.UID, exitedContainerID str
 | 
			
		||||
	if podStatus, err := kl.podCache.Get(podID); err == nil {
 | 
			
		||||
		removeAll := false
 | 
			
		||||
		if syncedPod, ok := kl.podManager.GetPodByUID(podID); ok {
 | 
			
		||||
			// When an evicted pod has already synced, all containers can be removed.
 | 
			
		||||
			removeAll = eviction.PodIsEvicted(syncedPod.Status)
 | 
			
		||||
			// generate the api status using the cached runtime status to get up-to-date ContainerStatuses
 | 
			
		||||
			apiPodStatus := kl.generateAPIPodStatus(syncedPod, podStatus)
 | 
			
		||||
			// When an evicted or deleted pod has already synced, all containers can be removed.
 | 
			
		||||
			removeAll = eviction.PodIsEvicted(syncedPod.Status) || (syncedPod.DeletionTimestamp != nil && notRunning(apiPodStatus.ContainerStatuses))
 | 
			
		||||
		}
 | 
			
		||||
		kl.containerDeletor.deleteContainersInPod(exitedContainerID, podStatus, removeAll)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user