Commit e04f994
committed
Fix metrics collection failure in network=host mode
When using hostinet (network=host), /proc/net/dev and /proc/net/snmp
may not be available inside the sandbox. Previously Statistics() returned
an error when these files were not opened, which propagated up and caused
the entire event/metrics collection to fail, breaking kubectl top pod.
Return zero-valued stats instead of an error when the proc files are
unavailable, as this is expected in hostinet mode. Real errors like
parse failures still propagate.
Fixes #127231 parent 140f64c commit e04f994
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
0 commit comments