Skip to content

Commit ef9e794

Browse files
authored
Merge pull request kubernetes#77656 from yastij/check-cstat-mem
check if Memory is not nil for container stats
2 parents a3f8e95 + f608736 commit ef9e794

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/kubelet/stats/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func cadvisorInfoToCPUandMemoryStats(info *cadvisorapiv2.ContainerInfo) (*statsa
5151
cpuStats.UsageCoreNanoSeconds = &cstat.Cpu.Usage.Total
5252
}
5353
}
54-
if info.Spec.HasMemory {
54+
if info.Spec.HasMemory && cstat.Memory != nil {
5555
pageFaults := cstat.Memory.ContainerData.Pgfault
5656
majorPageFaults := cstat.Memory.ContainerData.Pgmajfault
5757
memoryStats = &statsapi.MemoryStats{

0 commit comments

Comments
 (0)