kubelet_stats: fix potential e2e crash dereferencing CPU
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user