mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Fix panic in getNpdPodStat
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
30a68e4ad4
commit
fa44b9ca15
@ -384,9 +384,17 @@ func getNpdPodStat(ctx context.Context, f *framework.Framework, nodeName string)
|
|||||||
if !strings.HasPrefix(pod.PodRef.Name, "node-problem-detector") {
|
if !strings.HasPrefix(pod.PodRef.Name, "node-problem-detector") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cpuUsage = float64(*pod.CPU.UsageNanoCores) * 1e-9
|
if pod.CPU != nil && pod.CPU.UsageNanoCores != nil {
|
||||||
rss = float64(*pod.Memory.RSSBytes) / 1024 / 1024
|
cpuUsage = float64(*pod.CPU.UsageNanoCores) * 1e-9
|
||||||
workingSet = float64(*pod.Memory.WorkingSetBytes) / 1024 / 1024
|
}
|
||||||
|
if pod.Memory != nil {
|
||||||
|
if pod.Memory.RSSBytes != nil {
|
||||||
|
rss = float64(*pod.Memory.RSSBytes) / 1024 / 1024
|
||||||
|
}
|
||||||
|
if pod.Memory.WorkingSetBytes != nil {
|
||||||
|
workingSet = float64(*pod.Memory.WorkingSetBytes) / 1024 / 1024
|
||||||
|
}
|
||||||
|
}
|
||||||
hasNpdPod = true
|
hasNpdPod = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user