code: func (cgc *containerGC) evictContainers(gcPolicy kubecontainer.ContainerGCPolicy, allSourcesReady bool, evictTerminatedPods bool) error {
  	// Separate containers by evict units.
  	evictUnits, err := cgc.evictableContainers(gcPolicy.MinAge)
  	if err != nil {
  		return err
  	}
  
  	// Remove deleted pod containers if all sources are ready.
  	if allSourcesReady {
  		for key, unit := range evictUnits {
  			if cgc.podStateProvider.IsPodDeleted(key.uid) || (cgc.podStateProvider.IsPodTerminated(key.uid) && evictTerminatedPods) {
  				cgc.removeOldestN(unit, len(unit)) // Remove all.
  				delete(evictUnits, key)
  			}
  		}
  	}
  
  	// Enforce max containers per evict unit.
  	if gcPolicy.MaxPerPodContainer >= 0 {
  		cgc.enforceMaxContainersPerEvictUnit(evictUnits, gcPolicy.MaxPerPodContainer)
  	}
  
  	// Enforce max total number of containers.
  	if gcPolicy.MaxContainers >= 0 && evictUnits.NumContainers() > gcPolicy.MaxContainers {
  		// Leave an equal number of containers per evict unit (min: 1).
  		numContainersPerEvictUnit := gcPolicy.MaxContainers / evictUnits.NumEvictUnits()
  		if numContainersPerEvictUnit < 1 {
  			numContainersPerEvictUnit = 1
  		}
  		cgc.enforceMaxContainersPerEvictUnit(evictUnits, numContainersPerEvictUnit)
  
  		// If we still need to evict, evict oldest first.
  		numContainers := evictUnits.NumContainers()
  		if numContainers > gcPolicy.MaxContainers {
  			flattened := make([]containerGCInfo, 0, numContainers)
  			for key := range evictUnits {
  				flattened = append(flattened, evictUnits[key]...)
  			}
  			sort.Sort(byCreated(flattened))
  
  			cgc.removeOldestN(flattened, numContainers-gcPolicy.MaxContainers)
  		}
  	}
  	return nil
  }
docs: // evict all containers that are evictable