From 997e1f64424873b3b661782321eaea410a4f8a0c Mon Sep 17 00:00:00 2001 From: Ryan Phillips Date: Fri, 14 Jun 2019 20:30:36 -0500 Subject: [PATCH] kubelet_stats: fix potential e2e crash dereferencing CPU --- test/e2e/framework/kubelet_stats.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/framework/kubelet_stats.go b/test/e2e/framework/kubelet_stats.go index 7623795be42..de375496b82 100644 --- a/test/e2e/framework/kubelet_stats.go +++ b/test/e2e/framework/kubelet_stats.go @@ -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