mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Fix nil dereference if storage id is nil
This commit is contained in:
parent
c4f3017f15
commit
0b1f806557
@ -259,20 +259,22 @@ func (p *criStatsProvider) makeContainerStats(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
storageID := stats.WritableLayer.StorageId
|
storageID := stats.WritableLayer.StorageId
|
||||||
imageFsInfo, found := uuidToFsInfo[*storageID]
|
if storageID != nil {
|
||||||
if !found {
|
imageFsInfo, found := uuidToFsInfo[*storageID]
|
||||||
imageFsInfo = p.getFsInfo(storageID)
|
if !found {
|
||||||
uuidToFsInfo[*storageID] = imageFsInfo
|
imageFsInfo = p.getFsInfo(storageID)
|
||||||
}
|
uuidToFsInfo[*storageID] = imageFsInfo
|
||||||
if imageFsInfo != nil {
|
}
|
||||||
// The image filesystem UUID is unknown to the local node or there's an
|
if imageFsInfo != nil {
|
||||||
// error on retrieving the stats. In these cases, we omit those stats
|
// The image filesystem UUID is unknown to the local node or there's an
|
||||||
// and return the best-effort partial result. See
|
// error on retrieving the stats. In these cases, we omit those stats
|
||||||
// https://github.com/kubernetes/heapster/issues/1793.
|
// and return the best-effort partial result. See
|
||||||
result.Rootfs.AvailableBytes = &imageFsInfo.Available
|
// https://github.com/kubernetes/heapster/issues/1793.
|
||||||
result.Rootfs.CapacityBytes = &imageFsInfo.Capacity
|
result.Rootfs.AvailableBytes = &imageFsInfo.Available
|
||||||
result.Rootfs.InodesFree = imageFsInfo.InodesFree
|
result.Rootfs.CapacityBytes = &imageFsInfo.Capacity
|
||||||
result.Rootfs.Inodes = imageFsInfo.Inodes
|
result.Rootfs.InodesFree = imageFsInfo.InodesFree
|
||||||
|
result.Rootfs.Inodes = imageFsInfo.Inodes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user