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
1b9abdc9
Commit
1b9abdc9
authored
Mar 04, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22510 from gmarek/proxy
Auto commit by PR queue bot
parents
130c67f1
633d2cdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
15 deletions
+31
-15
kubelet_stats.go
test/e2e/kubelet_stats.go
+31
-15
No files found.
test/e2e/kubelet_stats.go
View file @
1b9abdc9
...
...
@@ -42,6 +42,11 @@ import (
"k8s.io/kubernetes/pkg/util/wait"
)
const
(
// timeout for proxy requests.
proxyTimeout
=
2
*
time
.
Minute
)
// KubeletMetric stores metrics scraped from the kubelet server's /metric endpoint.
// TODO: Get some more structure around the metrics and this type
type
KubeletMetric
struct
{
...
...
@@ -339,28 +344,39 @@ type usageDataPerContainer struct {
// Performs a get on a node proxy endpoint given the nodename and rest client.
func
nodeProxyRequest
(
c
*
client
.
Client
,
node
,
endpoint
string
)
(
restclient
.
Result
,
error
)
{
// proxy tends to hang in some cases when Node is not ready. Add an artificial timeout for this call.
// This will leak a goroutine if proxy hangs. #22165
subResourceProxyAvailable
,
err
:=
serverVersionGTE
(
subResourceServiceAndNodeProxyVersion
,
c
)
if
err
!=
nil
{
return
restclient
.
Result
{},
err
}
var
result
restclient
.
Result
if
subResourceProxyAvailable
{
result
=
c
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
finished
:=
make
(
chan
struct
{})
go
func
()
{
if
subResourceProxyAvailable
{
result
=
c
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
else
{
result
=
c
.
Get
()
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
else
{
result
=
c
.
Get
()
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
finished
<-
struct
{}{}
}()
select
{
case
<-
finished
:
return
result
,
nil
case
<-
time
.
After
(
proxyTimeout
)
:
return
restclient
.
Result
{},
nil
}
return
result
,
nil
}
// Retrieve metrics from the kubelet server of the given node.
...
...
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