mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
kubelet status manager: short-circut the evaluation if possible
This avoids redundant checks in the `PodResourcesAreReclaimed`, which also logs misleading "Pod is terminated" messages on every check.
This commit is contained in:
parent
017e61c76f
commit
ccfecb1ebd
@ -483,7 +483,10 @@ func (m *manager) needsUpdate(uid types.UID, status versionedPodStatus) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *manager) canBeDeleted(pod *v1.Pod, status v1.PodStatus) bool {
|
func (m *manager) canBeDeleted(pod *v1.Pod, status v1.PodStatus) bool {
|
||||||
return !kubepod.IsMirrorPod(pod) && m.podDeletionSafety.PodResourcesAreReclaimed(pod, status) && pod.DeletionTimestamp != nil
|
if pod.DeletionTimestamp == nil || kubepod.IsMirrorPod(pod) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return m.podDeletionSafety.PodResourcesAreReclaimed(pod, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
// needsReconcile compares the given status with the status in the pod manager (which
|
// needsReconcile compares the given status with the status in the pod manager (which
|
||||||
|
Loading…
Reference in New Issue
Block a user