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
5efa8aa7
Commit
5efa8aa7
authored
Mar 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22404 from yujuhong/dump_mem
Auto commit by PR queue bot
parents
e9d3be83
52d75d21
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
kubelet_perf.go
test/e2e/kubelet_perf.go
+8
-2
kubelet_stats.go
test/e2e/kubelet_stats.go
+16
-0
No files found.
test/e2e/kubelet_perf.go
View file @
5efa8aa7
...
...
@@ -99,7 +99,7 @@ func runResourceTrackingTest(framework *Framework, podsPerNode int, nodeNames se
usageSummary
,
err
:=
rm
.
GetLatest
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Logf
(
"%s"
,
rm
.
FormatResourceUsage
(
usageSummary
))
verifyMemoryLimits
(
expectedMemory
,
usageSummary
)
verifyMemoryLimits
(
framework
.
Client
,
expectedMemory
,
usageSummary
)
cpuSummary
:=
rm
.
GetCPUSummary
()
Logf
(
"%s"
,
rm
.
FormatCPUSummary
(
cpuSummary
))
...
...
@@ -109,7 +109,7 @@ func runResourceTrackingTest(framework *Framework, podsPerNode int, nodeNames se
DeleteRC
(
framework
.
Client
,
framework
.
Namespace
.
Name
,
rcName
)
}
func
verifyMemoryLimits
(
expected
resourceUsagePerContainer
,
actual
resourceUsagePerNode
)
{
func
verifyMemoryLimits
(
c
*
client
.
Client
,
expected
resourceUsagePerContainer
,
actual
resourceUsagePerNode
)
{
if
expected
==
nil
{
return
}
...
...
@@ -132,6 +132,12 @@ func verifyMemoryLimits(expected resourceUsagePerContainer, actual resourceUsage
}
if
len
(
nodeErrs
)
>
0
{
errList
=
append
(
errList
,
fmt
.
Sprintf
(
"node %v:
\n
%s"
,
nodeName
,
strings
.
Join
(
nodeErrs
,
", "
)))
heapStats
,
err
:=
getKubeletHeapStats
(
c
,
nodeName
)
if
err
!=
nil
{
Logf
(
"Unable to get heap stats from %q"
,
nodeName
)
}
else
{
Logf
(
"Heap stats on %q
\n
:%v"
,
nodeName
,
heapStats
)
}
}
}
if
len
(
errList
)
>
0
{
...
...
test/e2e/kubelet_stats.go
View file @
5efa8aa7
...
...
@@ -407,6 +407,22 @@ func getKubeletMetricsThroughNode(nodeName string) (string, error) {
return
string
(
body
),
nil
}
func
getKubeletHeapStats
(
c
*
client
.
Client
,
nodeName
string
)
(
string
,
error
)
{
client
,
err
:=
nodeProxyRequest
(
c
,
nodeName
,
"debug/pprof/heap"
)
if
err
!=
nil
{
return
""
,
err
}
raw
,
errRaw
:=
client
.
Raw
()
if
errRaw
!=
nil
{
return
""
,
err
}
stats
:=
string
(
raw
)
// Only dumping the runtime.MemStats numbers to avoid polluting the log.
numLines
:=
23
lines
:=
strings
.
Split
(
stats
,
"
\n
"
)
return
strings
.
Join
(
lines
[
len
(
lines
)
-
numLines
:
],
"
\n
"
),
nil
}
// GetKubeletPods retrieves the list of running pods on the kubelet. The pods
// includes necessary information (e.g., UID, name, namespace for
// pods/containers), but do not contain the full spec.
...
...
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