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

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)