mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	periodically check if pod can be deleted
This commit is contained in:
		@@ -388,7 +388,7 @@ func (m *manager) syncBatch() {
 | 
			
		||||
				}
 | 
			
		||||
				syncedUID = mirrorUID
 | 
			
		||||
			}
 | 
			
		||||
			if m.needsUpdate(syncedUID, status) {
 | 
			
		||||
			if m.needsUpdate(syncedUID, status) || m.couldBeDeleted(uid, status.status) {
 | 
			
		||||
				updatedStatuses = append(updatedStatuses, podStatusSyncRequest{uid, status})
 | 
			
		||||
			} else if m.needsReconcile(uid, status.status) {
 | 
			
		||||
				// Delete the apiStatusVersions here to force an update on the pod status
 | 
			
		||||
@@ -466,6 +466,15 @@ func (m *manager) needsUpdate(uid types.UID, status versionedPodStatus) bool {
 | 
			
		||||
	return !ok || latest < status.version
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *manager) couldBeDeleted(uid types.UID, status v1.PodStatus) bool {
 | 
			
		||||
	// The pod could be a static pod, so we should translate first.
 | 
			
		||||
	pod, ok := m.podManager.GetPodByUID(uid)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	return !kubepod.IsMirrorPod(pod) && m.podDeletionSafety.OkToDeletePod(pod)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// needsReconcile compares the given status with the status in the pod manager (which
 | 
			
		||||
// in fact comes from apiserver), returns whether the status needs to be reconciled with
 | 
			
		||||
// the apiserver. Now when pod status is inconsistent between apiserver and kubelet,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user