mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #89361 from fuweid/me-use-statsfunc
eviction: use previous statsFunc
This commit is contained in:
commit
f321d0ed12
@ -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
|
// 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 eviction happens in localStorageEviction function, skip the rest of eviction action
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) {
|
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
|
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
|
// 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.
|
// 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 {
|
func (m *managerImpl) localStorageEviction(pods []*v1.Pod, statsFunc statsFunc) []*v1.Pod {
|
||||||
statsFunc := cachedStatsFunc(summary.Pods)
|
|
||||||
evicted := []*v1.Pod{}
|
evicted := []*v1.Pod{}
|
||||||
for _, pod := range pods {
|
for _, pod := range pods {
|
||||||
podStats, ok := statsFunc(pod)
|
podStats, ok := statsFunc(pod)
|
||||||
|
Loading…
Reference in New Issue
Block a user