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
633d2cdf
Commit
633d2cdf
authored
Mar 04, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a workaround for hanging proxy in nodeProxyRequest
parent
679e27c1
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 @
633d2cdf
...
@@ -42,6 +42,11 @@ import (
...
@@ -42,6 +42,11 @@ import (
"k8s.io/kubernetes/pkg/util/wait"
"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.
// KubeletMetric stores metrics scraped from the kubelet server's /metric endpoint.
// TODO: Get some more structure around the metrics and this type
// TODO: Get some more structure around the metrics and this type
type
KubeletMetric
struct
{
type
KubeletMetric
struct
{
...
@@ -339,28 +344,39 @@ type usageDataPerContainer struct {
...
@@ -339,28 +344,39 @@ type usageDataPerContainer struct {
// Performs a get on a node proxy endpoint given the nodename and rest client.
// 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
)
{
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
)
subResourceProxyAvailable
,
err
:=
serverVersionGTE
(
subResourceServiceAndNodeProxyVersion
,
c
)
if
err
!=
nil
{
if
err
!=
nil
{
return
restclient
.
Result
{},
err
return
restclient
.
Result
{},
err
}
}
var
result
restclient
.
Result
var
result
restclient
.
Result
if
subResourceProxyAvailable
{
finished
:=
make
(
chan
struct
{})
result
=
c
.
Get
()
.
go
func
()
{
Resource
(
"nodes"
)
.
if
subResourceProxyAvailable
{
SubResource
(
"proxy"
)
.
result
=
c
.
Get
()
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Resource
(
"nodes"
)
.
Suffix
(
endpoint
)
.
SubResource
(
"proxy"
)
.
Do
()
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
else
{
}
else
{
result
=
c
.
Get
()
.
result
=
c
.
Get
()
.
Prefix
(
"proxy"
)
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Suffix
(
endpoint
)
.
Do
()
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.
// 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