From a809aaf03d8fdc9c36d97970e3d3b1f638f2768d Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Mon, 23 Mar 2020 19:11:17 +0800 Subject: [PATCH] eviction: use previous statsFunc No need to use summary to create statsFunc for localStorageEviction. Just use vals from makeSignalObservations. Signed-off-by: Wei Fu --- pkg/kubelet/eviction/eviction_manager.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/eviction/eviction_manager.go b/pkg/kubelet/eviction/eviction_manager.go index 54d6dfc2a59..da895e64203 100644 --- a/pkg/kubelet/eviction/eviction_manager.go +++ b/pkg/kubelet/eviction/eviction_manager.go @@ -320,7 +320,7 @@ func (m *managerImpl) synchronize(diskInfoProvider DiskInfoProvider, podFunc Act // evict pods if there is a resource usage violation from local volume temporary storage // If eviction happens in localStorageEviction function, skip the rest of eviction action if utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) { - if evictedPods := m.localStorageEviction(summary, activePods); len(evictedPods) > 0 { + if evictedPods := m.localStorageEviction(activePods, statsFunc); len(evictedPods) > 0 { return evictedPods } } @@ -450,8 +450,7 @@ func (m *managerImpl) reclaimNodeLevelResources(signalToReclaim evictionapi.Sign // localStorageEviction checks the EmptyDir volume usage for each pod and determine whether it exceeds the specified limit and needs // to be evicted. It also checks every container in the pod, if the container overlay usage exceeds the limit, the pod will be evicted too. -func (m *managerImpl) localStorageEviction(summary *statsapi.Summary, pods []*v1.Pod) []*v1.Pod { - statsFunc := cachedStatsFunc(summary.Pods) +func (m *managerImpl) localStorageEviction(pods []*v1.Pod, statsFunc statsFunc) []*v1.Pod { evicted := []*v1.Pod{} for _, pod := range pods { podStats, ok := statsFunc(pod)