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
700c1dc9
Commit
700c1dc9
authored
Jul 11, 2016
by
k8s-merge-robot
Committed by
GitHub
Jul 11, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #28796 from ronnielai/disk-inode-summary
Automatic merge from submit-queue Include inode info in container summary #28719
parents
0e3f94e9
2c71ce30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
summary.go
pkg/kubelet/server/stats/summary.go
+2
-0
summary_test.go
pkg/kubelet/server/stats/summary_test.go
+26
-2
No files found.
pkg/kubelet/server/stats/summary.go
View file @
700c1dc9
...
@@ -164,12 +164,14 @@ func (sb *summaryBuilder) containerInfoV2FsStats(
...
@@ -164,12 +164,14 @@ func (sb *summaryBuilder) containerInfoV2FsStats(
cs
.
Logs
=
&
stats
.
FsStats
{
cs
.
Logs
=
&
stats
.
FsStats
{
AvailableBytes
:
&
sb
.
rootFsInfo
.
Available
,
AvailableBytes
:
&
sb
.
rootFsInfo
.
Available
,
CapacityBytes
:
&
sb
.
rootFsInfo
.
Capacity
,
CapacityBytes
:
&
sb
.
rootFsInfo
.
Capacity
,
InodesFree
:
&
sb
.
rootFsInfo
.
InodesFree
,
}
}
// The container rootFs lives on the imageFs devices (which may not be the node root fs)
// The container rootFs lives on the imageFs devices (which may not be the node root fs)
cs
.
Rootfs
=
&
stats
.
FsStats
{
cs
.
Rootfs
=
&
stats
.
FsStats
{
AvailableBytes
:
&
sb
.
imageFsInfo
.
Available
,
AvailableBytes
:
&
sb
.
imageFsInfo
.
Available
,
CapacityBytes
:
&
sb
.
imageFsInfo
.
Capacity
,
CapacityBytes
:
&
sb
.
imageFsInfo
.
Capacity
,
InodesFree
:
&
sb
.
imageFsInfo
.
InodesFree
,
}
}
lcs
,
found
:=
sb
.
latestContainerStats
(
info
)
lcs
,
found
:=
sb
.
latestContainerStats
(
info
)
if
!
found
{
if
!
found
{
...
...
pkg/kubelet/server/stats/summary_test.go
View file @
700c1dc9
...
@@ -89,6 +89,14 @@ func TestBuildSummary(t *testing.T) {
...
@@ -89,6 +89,14 @@ func TestBuildSummary(t *testing.T) {
cName10
=
"c0"
// ensure cName10 conflicts with cName02, but is in a different pod
cName10
=
"c0"
// ensure cName10 conflicts with cName02, but is in a different pod
cName20
=
"c1"
// ensure cName20 conflicts with cName01, but is in a different pod + namespace
cName20
=
"c1"
// ensure cName20 conflicts with cName01, but is in a different pod + namespace
)
)
const
(
rootfsCapacity
=
uint64
(
10000000
)
rootfsAvailable
=
uint64
(
5000000
)
rootfsInodesFree
=
uint64
(
1000
)
imagefsCapacity
=
uint64
(
20000000
)
imagefsAvailable
=
uint64
(
8000000
)
imagefsInodesFree
=
uint64
(
2000
)
)
prf0
:=
kubestats
.
PodReference
{
Name
:
pName0
,
Namespace
:
namespace0
,
UID
:
"UID"
+
pName0
}
prf0
:=
kubestats
.
PodReference
{
Name
:
pName0
,
Namespace
:
namespace0
,
UID
:
"UID"
+
pName0
}
prf1
:=
kubestats
.
PodReference
{
Name
:
pName1
,
Namespace
:
namespace0
,
UID
:
"UID"
+
pName1
}
prf1
:=
kubestats
.
PodReference
{
Name
:
pName1
,
Namespace
:
namespace0
,
UID
:
"UID"
+
pName1
}
...
@@ -110,8 +118,16 @@ func TestBuildSummary(t *testing.T) {
...
@@ -110,8 +118,16 @@ func TestBuildSummary(t *testing.T) {
"/pod2-c0"
:
summaryTestContainerInfo
(
seedPod2Container
,
pName2
,
namespace2
,
cName20
),
"/pod2-c0"
:
summaryTestContainerInfo
(
seedPod2Container
,
pName2
,
namespace2
,
cName20
),
}
}
rootfs
:=
v2
.
FsInfo
{}
rootfs
:=
v2
.
FsInfo
{
imagefs
:=
v2
.
FsInfo
{}
Capacity
:
rootfsCapacity
,
Available
:
rootfsAvailable
,
InodesFree
:
rootfsInodesFree
,
}
imagefs
:=
v2
.
FsInfo
{
Capacity
:
imagefsCapacity
,
Available
:
imagefsAvailable
,
InodesFree
:
imagefsInodesFree
,
}
// memory limit overrides for each container (used to test available bytes if a memory limit is known)
// memory limit overrides for each container (used to test available bytes if a memory limit is known)
memoryLimitOverrides
:=
map
[
string
]
uint64
{
memoryLimitOverrides
:=
map
[
string
]
uint64
{
...
@@ -159,6 +175,8 @@ func TestBuildSummary(t *testing.T) {
...
@@ -159,6 +175,8 @@ func TestBuildSummary(t *testing.T) {
assert
.
EqualValues
(
t
,
testTime
(
creationTime
,
seed
)
.
Unix
(),
sys
.
StartTime
.
Time
.
Unix
(),
name
+
".StartTime"
)
assert
.
EqualValues
(
t
,
testTime
(
creationTime
,
seed
)
.
Unix
(),
sys
.
StartTime
.
Time
.
Unix
(),
name
+
".StartTime"
)
checkCPUStats
(
t
,
name
,
seed
,
sys
.
CPU
)
checkCPUStats
(
t
,
name
,
seed
,
sys
.
CPU
)
checkMemoryStats
(
t
,
name
,
seed
,
info
,
sys
.
Memory
)
checkMemoryStats
(
t
,
name
,
seed
,
info
,
sys
.
Memory
)
checkFsStats
(
t
,
rootfsCapacity
,
rootfsAvailable
,
rootfsInodesFree
,
sys
.
Logs
)
checkFsStats
(
t
,
imagefsCapacity
,
imagefsAvailable
,
imagefsInodesFree
,
sys
.
Rootfs
)
}
}
assert
.
Equal
(
t
,
3
,
len
(
summary
.
Pods
))
assert
.
Equal
(
t
,
3
,
len
(
summary
.
Pods
))
...
@@ -350,6 +368,12 @@ func checkMemoryStats(t *testing.T, label string, seed int, info v2.ContainerInf
...
@@ -350,6 +368,12 @@ func checkMemoryStats(t *testing.T, label string, seed int, info v2.ContainerInf
}
}
}
}
func
checkFsStats
(
t
*
testing
.
T
,
capacity
uint64
,
Available
uint64
,
inodesFree
uint64
,
fs
*
kubestats
.
FsStats
)
{
assert
.
EqualValues
(
t
,
capacity
,
*
fs
.
CapacityBytes
)
assert
.
EqualValues
(
t
,
Available
,
*
fs
.
AvailableBytes
)
assert
.
EqualValues
(
t
,
inodesFree
,
*
fs
.
InodesFree
)
}
func
TestCustomMetrics
(
t
*
testing
.
T
)
{
func
TestCustomMetrics
(
t
*
testing
.
T
)
{
spec
:=
[]
v1
.
MetricSpec
{
spec
:=
[]
v1
.
MetricSpec
{
{
{
...
...
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