kubelet: Fix mirrorPodTerminationMap leak

This commit is contained in:
Geonju Kim 2021-01-16 01:13:17 +09:00 committed by Geonju Kim
parent 9bcb451d7d
commit 1563fb68e6

View File

@ -1771,6 +1771,9 @@ func (kl *Kubelet) deletePod(pod *v1.Pod) error {
}
podPair := kubecontainer.PodPair{APIPod: pod, RunningPod: &runningPod}
if _, ok := kl.podManager.GetMirrorPodByPod(pod); ok {
kl.podKiller.MarkMirrorPodPendingTermination(pod)
}
kl.podKiller.KillPod(&podPair)
// We leave the volume/directory cleanup to the periodic cleanup routine.
@ -2109,9 +2112,6 @@ func (kl *Kubelet) HandlePodRemoves(pods []*v1.Pod) {
kl.handleMirrorPod(pod, start)
continue
}
if _, ok := kl.podManager.GetMirrorPodByPod(pod); ok {
kl.podKiller.MarkMirrorPodPendingTermination(pod)
}
// Deletion is allowed to fail because the periodic cleanup routine
// will trigger deletion again.
if err := kl.deletePod(pod); err != nil {