mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
kubelet_stats: fix potential e2e crash dereferencing CPU
This commit is contained in:
parent
d1e828f8df
commit
997e1f6442
@ -598,6 +598,9 @@ func (r *resourceCollector) collectStats(oldStatsMap map[string]*stats.Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
if oldStats, ok := oldStatsMap[name]; ok {
|
if oldStats, ok := oldStatsMap[name]; ok {
|
||||||
|
if oldStats.CPU == nil || cStats.CPU == nil || oldStats.Memory == nil || cStats.Memory == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if oldStats.CPU.Time.Equal(&cStats.CPU.Time) {
|
if oldStats.CPU.Time.Equal(&cStats.CPU.Time) {
|
||||||
// No change -> skip this stat.
|
// No change -> skip this stat.
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user