kubernetes/pkg/kubelet/stats
Peter Hunt 1c3357db76 kubelet/stats: take container log stats into account when checking ephemeral stats
this commit updates checkEphemeralStorage to be able to add container log stats, if applicable.

It also updates the old check when container log stats aren't found to be more accurate.
Specifically, this check previously worked because of a fluke programming accident:

according to this block in pkg/kubelet/stats/helper.go:113
```
if result.Rootfs != nil {
    rootfsUsage := *cfs.BaseUsageBytes
    result.Rootfs.UsedBytes = &rootfsUsage
}
```

BaseUsageBytes should be the value added, not TotalUsageBytes. However, since in this case
one also needs to account for the calculated log size, which is TotalUsageBytes - BaseUsageBytes
using TotalUsageBytes value accidentally worked.

Updating the case to use the correct value AND log offset fixes this accident and makes
the behavior more in line with what happens when calculating ephemeral storage.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-02-15 16:30:25 -05:00
..
pidlimit Merge pull request #107108 from linxiulei/fix_pid 2022-02-10 01:15:47 -08:00
cadvisor_stats_provider_test.go kubelet/stats: take container log stats into account when checking ephemeral stats 2022-02-15 16:30:25 -05:00
cadvisor_stats_provider.go kubelet/stats: update cadvisor stats provider with new log location 2022-02-15 16:04:16 -05:00
cri_stats_provider_others.go generated: Run hack/update-gofmt.sh 2021-08-24 15:47:49 -04:00
cri_stats_provider_test.go Make CRI v1 the default and allow a fallback to v1alpha2 2021-11-17 11:05:05 -08:00
cri_stats_provider_windows_test.go Get networks stats directly 2021-11-10 12:43:56 -08:00
cri_stats_provider_windows.go Get networks stats directly 2021-11-10 12:43:56 -08:00
cri_stats_provider.go Make CRI v1 the default and allow a fallback to v1alpha2 2021-11-17 11:05:05 -08:00
helper_test.go Move Kubelet Summary API to staging repo 2020-09-22 18:23:28 +02:00
helper.go kubelet/stats: update cadvisor stats provider with new log location 2022-02-15 16:04:16 -05:00
host_stats_provider_fake.go Remove now-unused eviction helpers, fix unit test TestCRIListPodStats 2020-12-03 13:04:25 -07:00
host_stats_provider_test.go Clean up logic for deprecated flag --container-runtime in kubelet 2022-02-10 13:26:59 +02:00
host_stats_provider.go Clean up logic for deprecated flag --container-runtime in kubelet 2022-02-10 13:26:59 +02:00
OWNERS Check in OWNERS modified by update-yamlfmt.sh 2021-12-09 21:31:26 -05:00
provider_test.go kubelet/stats: take container log stats into account when checking ephemeral stats 2022-02-15 16:30:25 -05:00
provider.go kubelet stats: wire up podAndContainerStatsFromCRI feature gate 2021-10-29 09:40:20 -04:00