Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3fa2e747
Unverified
Commit
3fa2e747
authored
Aug 06, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Aug 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #80642 from humblec/automated-cherry-pick-of-#78222-upstream-release-1.15
Automated cherry pick of #78222: Fix nil pointer dereference in metrics value calculator.
parents
a8951d5e
388a9e1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
volume_stat_calculator.go
pkg/kubelet/server/stats/volume_stat_calculator.go
+20
-6
No files found.
pkg/kubelet/server/stats/volume_stat_calculator.go
View file @
3fa2e747
...
@@ -138,12 +138,26 @@ func (s *volumeStatCalculator) calcAndStoreStats() {
...
@@ -138,12 +138,26 @@ func (s *volumeStatCalculator) calcAndStoreStats() {
// parsePodVolumeStats converts (internal) volume.Metrics to (external) stats.VolumeStats structures
// parsePodVolumeStats converts (internal) volume.Metrics to (external) stats.VolumeStats structures
func
(
s
*
volumeStatCalculator
)
parsePodVolumeStats
(
podName
string
,
pvcRef
*
stats
.
PVCReference
,
metric
*
volume
.
Metrics
,
volSpec
v1
.
Volume
)
stats
.
VolumeStats
{
func
(
s
*
volumeStatCalculator
)
parsePodVolumeStats
(
podName
string
,
pvcRef
*
stats
.
PVCReference
,
metric
*
volume
.
Metrics
,
volSpec
v1
.
Volume
)
stats
.
VolumeStats
{
available
:=
uint64
(
metric
.
Available
.
Value
())
capacity
:=
uint64
(
metric
.
Capacity
.
Value
())
var
available
,
capacity
,
used
,
inodes
,
inodesFree
,
inodesUsed
uint64
used
:=
uint64
(
metric
.
Used
.
Value
())
if
metric
.
Available
!=
nil
{
inodes
:=
uint64
(
metric
.
Inodes
.
Value
())
available
=
uint64
(
metric
.
Available
.
Value
())
inodesFree
:=
uint64
(
metric
.
InodesFree
.
Value
())
}
inodesUsed
:=
uint64
(
metric
.
InodesUsed
.
Value
())
if
metric
.
Capacity
!=
nil
{
capacity
=
uint64
(
metric
.
Capacity
.
Value
())
}
if
metric
.
Used
!=
nil
{
used
=
uint64
(
metric
.
Used
.
Value
())
}
if
metric
.
Inodes
!=
nil
{
inodes
=
uint64
(
metric
.
Inodes
.
Value
())
}
if
metric
.
InodesFree
!=
nil
{
inodesFree
=
uint64
(
metric
.
InodesFree
.
Value
())
}
if
metric
.
InodesUsed
!=
nil
{
inodesUsed
=
uint64
(
metric
.
InodesUsed
.
Value
())
}
return
stats
.
VolumeStats
{
return
stats
.
VolumeStats
{
Name
:
podName
,
Name
:
podName
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment