UPSTREAM: kubelet_stats: fix potential e2e crash dereferencing CPU
@@ -590,6 +590,9 @@ func (r *resourceCollector) collectStats(oldStatsMap map[string]*stats.Container
}
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) {
// No change -> skip this stat.
continue
