3 Commits

Author SHA1 Message Date
Damien Grisonnet
4f01955a87 kubelet/cadvisor: disable container discovery when using CRI stats
When the container runtime provides stats via CRI, cAdvisor only needs
to track the root container for node-level resource and filesystem
metrics. Set DisableContainerDiscovery on the cAdvisor manager to skip
plugin initialization, cgroup watchers, and subcontainer scanning in
that mode.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2026-07-15 14:51:05 +02:00
Davanum Srinivas
0e1f1daae1 kubelet: read OOM events in-tree and drop the cadvisor oomparser dependency
The kubelet used cadvisor's lib/utils/oomparser to watch the kernel log for
OOM kills and to produce the container_oom_events_total metric. That made the
kubelet depend on the cadvisor lib module for OOM handling.

This moves OOM handling in-tree:

- The OOM kill parser is forked from cadvisor into
  third_party/forked/cadvisor/oomparser. It reads /dev/kmsg and extracts OOM
  events, adapted to take a context.Context and log through klog.
- The kmsg reader is forked from github.com/euank/go-kmsg-parser into
  third_party/forked/go-kmsg-parser/kmsgparser.
- The kubelet OOM watcher reads OOM events through the forked parser and
  records the container_oom_events_total metric in-tree.
- cadvisor/lib is bumped to v0.60.3, which no longer ships the OOM parser.
  This removes the transitive github.com/euank/go-kmsg-parser
  v2.0.0+incompatible dependency and the vendored cadvisor lib/utils/oomparser
  package.

Behavior is unchanged. OOM events are still emitted and the metric still
reports the same counts.
2026-06-26 20:35:19 -04:00
Davanum Srinivas
f451aa0762 kubelet: depend on github.com/google/cadvisor/lib
Migrate the kubelet (and the kube-proxy conntrack helper) off the full github.com/google/cadvisor module onto the lean github.com/google/cadvisor/lib: repoint info/v1+info/v2 type usage to lib/model and the manager/fs/cache/etc. consumers to lib/*; regenerate the cadvisor.Interface mocks; keep the kubelet-pinned cAdvisor global flags via lib/cadvisorflags.

go.mod: require + replace github.com/google/cadvisor/lib (=> the dims/cadvisor/lib fork for now, until lib is tagged) and drop the full github.com/google/cadvisor module entirely; keep github.com/containerd/containerd/api at v1.11.0 (matching upstream master); add github.com/google/cadvisor to unwanted-dependencies.json unwantedModules so the full module cannot be re-vendored.

test/e2e_node: the one remaining consumer of the full module -- the node-e2e ResourceCollector, which used the v2 HTTP client (client/v2) + v2 API types (info/v2) -- now scrapes the standalone cAdvisor pod's /api/v2.1/stats directly over HTTP+JSON, so test/e2e_node depends on no cAdvisor package. No change to the kubelet's stats surfaces.
2026-06-20 17:27:16 -04:00