From 06b44c76fd7c7a22a2b756d5bd582631a607a18e Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Sun, 5 Jan 2020 09:21:04 -0500 Subject: [PATCH] Correct comment around which integrations require cadvisor_stats This commit is part of a larger effort to clean up references to `rkt` in the kubelet. Previously, this comment hard-coded which integrations required the cadvisor stats provider. The comment has grown stale (i.e. referenced rkt and did not reference cri-o). Update the comment to instead point to the code which determines which integrations need the cadvisor stats provider. --- pkg/kubelet/cadvisor/util.go | 2 +- pkg/kubelet/stats/cadvisor_stats_provider.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/cadvisor/util.go b/pkg/kubelet/cadvisor/util.go index 571d978637f..8fdf0b9dae6 100644 --- a/pkg/kubelet/cadvisor/util.go +++ b/pkg/kubelet/cadvisor/util.go @@ -70,7 +70,7 @@ func EphemeralStorageCapacityFromFsInfo(info cadvisorapi2.FsInfo) v1.ResourceLis // CRI integrations should get container metrics via CRI. Docker // uses the built-in cadvisor to gather such metrics on Linux for // historical reasons. -// cri-o relies on cadvisor as a temporary workaround. The code should +// TODO: cri-o relies on cadvisor as a temporary workaround. The code should // be removed. Related issue: // https://github.com/kubernetes/kubernetes/issues/51798 func UsingLegacyCadvisorStats(runtime, runtimeEndpoint string) bool { diff --git a/pkg/kubelet/stats/cadvisor_stats_provider.go b/pkg/kubelet/stats/cadvisor_stats_provider.go index 319040349e9..18b59dbc7e4 100644 --- a/pkg/kubelet/stats/cadvisor_stats_provider.go +++ b/pkg/kubelet/stats/cadvisor_stats_provider.go @@ -38,8 +38,10 @@ import ( ) // cadvisorStatsProvider implements the containerStatsProvider interface by -// getting the container stats from cAdvisor. This is needed by docker and rkt -// integrations since they do not provide stats from CRI. +// getting the container stats from cAdvisor. This is needed by +// integrations which do not provide stats from CRI. See +// `pkg/kubelet/cadvisor/util.go#UsingLegacyCadvisorStats` for the logic for +// determining which integrations do not provide stats from CRI. type cadvisorStatsProvider struct { // cadvisor is used to get the stats of the cgroup for the containers that // are managed by pods.