Merge pull request #78368 from tedyu/evict-sandboxes
Call getKubeletSandboxes first in containerGC#evictSandboxes
This commit is contained in:
commit
becf718143
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user