Merge pull request #78368 from tedyu/evict-sandboxes

Call getKubeletSandboxes first in containerGC#evictSandboxes
This commit is contained in:
Kubernetes Prow Robot 2019-07-11 14:33:21 -07:00 committed by GitHub
commit becf718143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,17 +277,17 @@ func (cgc *containerGC) evictSandboxes(evictTerminatedPods bool) error {
return err return err
} }
sandboxes, err := cgc.manager.getKubeletSandboxes(true)
if err != nil {
return err
}
// collect all the PodSandboxId of container // collect all the PodSandboxId of container
sandboxIDs := sets.NewString() sandboxIDs := sets.NewString()
for _, container := range containers { for _, container := range containers {
sandboxIDs.Insert(container.PodSandboxId) sandboxIDs.Insert(container.PodSandboxId)
} }
sandboxes, err := cgc.manager.getKubeletSandboxes(true)
if err != nil {
return err
}
sandboxesByPod := make(sandboxesByPodUID) sandboxesByPod := make(sandboxesByPodUID)
for _, sandbox := range sandboxes { for _, sandbox := range sandboxes {
podUID := types.UID(sandbox.Metadata.Uid) podUID := types.UID(sandbox.Metadata.Uid)