mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-21 00:33:15 +00:00
properly support the resource metrics endpoint when `PodAndContainerStatsFromCRI` is enabled and fix the related e2e tests. Stats Provider: - add container-level CPU and memory stats to `ListPodCPUAndMemoryStats` so the resource metrics endpoint has complete data - add `aggregatePodSwapStats` to compute pod-level swap from container stats (CRI doesn't provide pod-level swap directly) - add missing memory stats fields: `AvailableBytes`, `PageFaults`, and `MajorPageFaults` - add platform-specific implementations for Linux and Windows Tests: - skip cAdvisor metrics test when `PodAndContainerStatsFromCRI` is enabled (cAdvisor metrics aren't available in that mode) - fix expected metrics in `ResourceMetricsAPI` test - `node_swap_usage_bytes` is only available with cAdvisor (need to verify!) - Add `dumpResourceMetricsForPods` helper to log actual metric values when tests fail, making debugging easier Signed-off-by: Davanum Srinivas <davanum@gmail.com>