Merge pull request #29080 from Random-Liu/continue-cleanup-despite-of-error

Automatic merge from submit-queue

Make kubelet continue cleanup when there is noncritical error.

Fix https://github.com/kubernetes/kubernetes/issues/29078.

Even though there is error when cleaning up pod directory or bandwidth limits, kubelet could continue cleanup the following stuff.
However, when runtime cache or runtime returns error, cleanup should fail, because the following cleanup relies on the `runningPod`.

@yujuhong 
/cc @kubernetes/sig-node
pull/6/head
k8s-merge-robot 2016-07-19 01:43:29 -07:00 committed by GitHub
commit 6c1675a5cd
1 changed files with 7 additions and 4 deletions

View File

@ -2091,20 +2091,23 @@ func (kl *Kubelet) HandlePodCleanups() error {
// deleted pods.
err = kl.cleanupOrphanedPodDirs(allPods, runningPods)
if err != nil {
// We want all cleanup tasks to be run even if one of them failed. So
// we just log an error here and continue other cleanup tasks.
// This also applies to the other clean up tasks.
glog.Errorf("Failed cleaning up orphaned pod directories: %v", err)
return err
}
// Remove any orphaned mirror pods.
kl.podManager.DeleteOrphanedMirrorPods()
// Clear out any old bandwidth rules
if err = kl.cleanupBandwidthLimits(allPods); err != nil {
return err
err = kl.cleanupBandwidthLimits(allPods)
if err != nil {
glog.Errorf("Failed cleaning up bandwidth limits: %v", err)
}
kl.backOff.GC()
return err
return nil
}
// podKiller launches a goroutine to kill a pod received from the channel if