kubelet_stats: fix potential e2e crash dereferencing CPU

This commit is contained in:
Ryan Phillips 2019-06-14 20:30:36 -05:00
parent d1e828f8df
commit 997e1f6442

View File

@ -598,6 +598,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