Rework hostfs metrics
Ephemeral storage usage should be calculated by the metrics code, not the eviction code.
This commit is contained in:
@@ -351,7 +351,7 @@ func uint64Ptr(i uint64) *uint64 {
|
||||
}
|
||||
|
||||
func calcEphemeralStorage(containers []statsapi.ContainerStats, volumes []statsapi.VolumeStats, rootFsInfo *cadvisorapiv2.FsInfo,
|
||||
podLogStats *statsapi.FsStats, isCRIStatsProvider bool) *statsapi.FsStats {
|
||||
podLogStats *statsapi.FsStats, etcHostsStats *statsapi.FsStats, isCRIStatsProvider bool) *statsapi.FsStats {
|
||||
result := &statsapi.FsStats{
|
||||
Time: metav1.NewTime(rootFsInfo.Timestamp),
|
||||
AvailableBytes: &rootFsInfo.Available,
|
||||
@@ -372,6 +372,11 @@ func calcEphemeralStorage(containers []statsapi.ContainerStats, volumes []statsa
|
||||
result.InodesUsed = addUsage(result.InodesUsed, podLogStats.InodesUsed)
|
||||
result.Time = maxUpdateTime(&result.Time, &podLogStats.Time)
|
||||
}
|
||||
if etcHostsStats != nil {
|
||||
result.UsedBytes = addUsage(result.UsedBytes, etcHostsStats.UsedBytes)
|
||||
result.InodesUsed = addUsage(result.InodesUsed, etcHostsStats.InodesUsed)
|
||||
result.Time = maxUpdateTime(&result.Time, &etcHostsStats.Time)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user