mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #13293 from yujuhong/pod_dir
Auto commit by PR queue bot
This commit is contained in:
commit
5331a26c5b
@ -1380,12 +1380,20 @@ func (kl *Kubelet) cleanupOrphanedPodDirs(pods []*api.Pod, runningPods []*kubeco
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
errlist := []error{}
|
errlist := []error{}
|
||||||
for i := range found {
|
for _, uid := range found {
|
||||||
if !active.Has(string(found[i])) {
|
if active.Has(string(uid)) {
|
||||||
glog.V(3).Infof("Orphaned pod %q found, removing", found[i])
|
continue
|
||||||
if err := os.RemoveAll(kl.getPodDir(found[i])); err != nil {
|
}
|
||||||
errlist = append(errlist, err)
|
if err := os.Remove(kl.getPodVolumesDir(uid)); err != nil {
|
||||||
}
|
// If we cannot remove the volumes directory, it implies that the
|
||||||
|
// the directory is not empty. We should wait for the volume
|
||||||
|
// cleanup to complete before attempting to delete the directory.
|
||||||
|
glog.V(3).Infof("Orphaned pod %q found, but unable to remove the volume directory", uid)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
glog.V(3).Infof("Orphaned pod %q found, removing", uid)
|
||||||
|
if err := os.RemoveAll(kl.getPodDir(uid)); err != nil {
|
||||||
|
errlist = append(errlist, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return utilErrors.NewAggregate(errlist)
|
return utilErrors.NewAggregate(errlist)
|
||||||
|
Loading…
Reference in New Issue
Block a user