mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #52588 from bobbypage/cristatsprovider-fixes
Automatic merge from submit-queue (batch tested with PRs 52486, 52588, 52524). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Fix nil pointer dereference in cri stats provider when there are no image file systems **What this PR does / why we need it**: This PR fixes a nil pointer dereference in CRI stats provider when there are no image filesystems. See https://github.com/kubernetes/kubernetes/pull/51152 for discussion. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note ``` /cc yujuhong yguo0905
This commit is contained in:
commit
02731cc767
@ -258,7 +258,8 @@ func (p *criStatsProvider) makeContainerStats(
|
||||
result.Rootfs.InodesUsed = &stats.WritableLayer.InodesUsed.Value
|
||||
}
|
||||
}
|
||||
storageID := stats.WritableLayer.StorageId
|
||||
storageID := stats.GetWritableLayer().GetStorageId()
|
||||
if storageID != nil {
|
||||
imageFsInfo, found := uuidToFsInfo[*storageID]
|
||||
if !found {
|
||||
imageFsInfo = p.getFsInfo(storageID)
|
||||
@ -274,6 +275,7 @@ func (p *criStatsProvider) makeContainerStats(
|
||||
result.Rootfs.InodesFree = imageFsInfo.InodesFree
|
||||
result.Rootfs.Inodes = imageFsInfo.Inodes
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user