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
32675e6f
Commit
32675e6f
authored
Nov 03, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove check for SubResourcePodProxyVersion and SubResourceServiceAndNodeProxyVersion
parent
026197fb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
235 deletions
+78
-235
kubelet_stats.go
test/e2e/framework/kubelet_stats.go
+15
-47
metrics_util.go
test/e2e/framework/metrics_util.go
+8
-24
util.go
test/e2e/framework/util.go
+16
-60
influxdb.go
test/e2e/instrumentation/monitoring/influxdb.go
+12
-33
kubectl.go
test/e2e/kubectl/kubectl.go
+9
-24
dns.go
test/e2e/network/dns.go
+9
-24
pre_stop.go
test/e2e/pre_stop.go
+9
-23
No files found.
test/e2e/framework/kubelet_stats.go
View file @
32675e6f
...
...
@@ -280,33 +280,17 @@ func HighLatencyKubeletOperations(c clientset.Interface, threshold time.Duration
// getStatsSummary contacts kubelet for the container information.
func
getStatsSummary
(
c
clientset
.
Interface
,
nodeName
string
)
(
*
stats
.
Summary
,
error
)
{
subResourceProxyAvailable
,
err
:=
ServerVersionGTE
(
SubResourceServiceAndNodeProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
nil
,
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
SingleCallTimeout
)
defer
cancel
()
var
data
[]
byte
if
subResourceProxyAvailable
{
data
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
Do
()
.
Raw
()
}
else
{
data
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
Do
()
.
Raw
()
}
data
,
err
:=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
Do
()
.
Raw
()
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -406,30 +390,14 @@ func getOneTimeResourceUsageOnNode(
}
func
getNodeStatsSummary
(
c
clientset
.
Interface
,
nodeName
string
)
(
*
stats
.
Summary
,
error
)
{
subResourceProxyAvailable
,
err
:=
ServerVersionGTE
(
SubResourceServiceAndNodeProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
nil
,
err
}
data
,
err
:=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
SetHeader
(
"Content-Type"
,
"application/json"
)
.
Do
()
.
Raw
()
var
data
[]
byte
if
subResourceProxyAvailable
{
data
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
SetHeader
(
"Content-Type"
,
"application/json"
)
.
Do
()
.
Raw
()
}
else
{
data
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
nodeName
,
ports
.
KubeletPort
))
.
Suffix
(
"stats/summary"
)
.
SetHeader
(
"Content-Type"
,
"application/json"
)
.
Do
()
.
Raw
()
}
if
err
!=
nil
{
return
nil
,
err
}
...
...
test/e2e/framework/metrics_util.go
View file @
32675e6f
...
...
@@ -443,11 +443,6 @@ func getSchedulingLatency(c clientset.Interface) (*SchedulingLatency, error) {
nodes
,
err
:=
c
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
ExpectNoError
(
err
)
subResourceProxyAvailable
,
err
:=
ServerVersionGTE
(
SubResourcePodProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
nil
,
err
}
var
data
string
var
masterRegistered
=
false
for
_
,
node
:=
range
nodes
.
Items
{
...
...
@@ -460,25 +455,14 @@ func getSchedulingLatency(c clientset.Interface) (*SchedulingLatency, error) {
defer
cancel
()
var
rawData
[]
byte
if
subResourceProxyAvailable
{
rawData
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
metav1
.
NamespaceSystem
)
.
Resource
(
"pods"
)
.
Name
(
fmt
.
Sprintf
(
"kube-scheduler-%v:%v"
,
TestContext
.
CloudConfig
.
MasterName
,
ports
.
SchedulerPort
))
.
SubResource
(
"proxy"
)
.
Suffix
(
"metrics"
)
.
Do
()
.
Raw
()
}
else
{
rawData
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Namespace
(
metav1
.
NamespaceSystem
)
.
SubResource
(
"pods"
)
.
Name
(
fmt
.
Sprintf
(
"kube-scheduler-%v:%v"
,
TestContext
.
CloudConfig
.
MasterName
,
ports
.
SchedulerPort
))
.
Suffix
(
"metrics"
)
.
Do
()
.
Raw
()
}
rawData
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
metav1
.
NamespaceSystem
)
.
Resource
(
"pods"
)
.
Name
(
fmt
.
Sprintf
(
"kube-scheduler-%v:%v"
,
TestContext
.
CloudConfig
.
MasterName
,
ports
.
SchedulerPort
))
.
SubResource
(
"proxy"
)
.
Suffix
(
"metrics"
)
.
Do
()
.
Raw
()
ExpectNoError
(
err
)
data
=
string
(
rawData
)
...
...
test/e2e/framework/util.go
View file @
32675e6f
...
...
@@ -244,24 +244,8 @@ func GetPauseImageNameForHostArch() string {
return
currentPodInfraContainerImageName
+
"-"
+
goruntime
.
GOARCH
+
":"
+
currentPodInfraContainerImageVersion
}
// SubResource proxy should have been functional in v1.0.0, but SubResource
// proxy via tunneling is known to be broken in v1.0. See
// https://github.com/kubernetes/kubernetes/pull/15224#issuecomment-146769463
//
// TODO(ihmccreery): remove once we don't care about v1.0 anymore, (tentatively
// in v1.3).
var
SubResourcePodProxyVersion
=
utilversion
.
MustParseSemantic
(
"v1.1.0"
)
var
SubResourceServiceAndNodeProxyVersion
=
utilversion
.
MustParseSemantic
(
"v1.2.0"
)
func
GetServicesProxyRequest
(
c
clientset
.
Interface
,
request
*
restclient
.
Request
)
(
*
restclient
.
Request
,
error
)
{
subResourceProxyAvailable
,
err
:=
ServerVersionGTE
(
SubResourceServiceAndNodeProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
nil
,
err
}
if
subResourceProxyAvailable
{
return
request
.
Resource
(
"services"
)
.
SubResource
(
"proxy"
),
nil
}
return
request
.
Prefix
(
"proxy"
)
.
Resource
(
"services"
),
nil
return
request
.
Resource
(
"services"
)
.
SubResource
(
"proxy"
),
nil
}
// unique identifier of the e2e run
...
...
@@ -1672,34 +1656,19 @@ func (r podProxyResponseChecker) CheckAllResponses() (done bool, err error) {
if
!
isElementOf
(
pod
.
UID
,
currentPods
)
{
return
false
,
fmt
.
Errorf
(
"pod with UID %s is no longer a member of the replica set. Must have been restarted for some reason. Current replica set: %v"
,
pod
.
UID
,
currentPods
)
}
subResourceProxyAvailable
,
err
:=
ServerVersionGTE
(
SubResourcePodProxyVersion
,
r
.
c
.
Discovery
())
if
err
!=
nil
{
return
false
,
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
SingleCallTimeout
)
defer
cancel
()
var
body
[]
byte
if
subResourceProxyAvailable
{
body
,
err
=
r
.
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
r
.
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
string
(
pod
.
Name
))
.
Do
()
.
Raw
()
}
else
{
body
,
err
=
r
.
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Namespace
(
r
.
ns
)
.
Resource
(
"pods"
)
.
Name
(
string
(
pod
.
Name
))
.
Do
()
.
Raw
()
}
body
,
err
:=
r
.
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
r
.
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
string
(
pod
.
Name
))
.
Do
()
.
Raw
()
if
err
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
// We may encounter errors here because of a race between the pod readiness and apiserver
...
...
@@ -4404,29 +4373,16 @@ const proxyTimeout = 2 * time.Minute
func
NodeProxyRequest
(
c
clientset
.
Interface
,
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
.
Discovery
())
if
err
!=
nil
{
return
restclient
.
Result
{},
err
}
var
result
restclient
.
Result
finished
:=
make
(
chan
struct
{})
go
func
()
{
if
subResourceProxyAvailable
{
result
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
result
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Resource
(
"nodes"
)
.
SubResource
(
"proxy"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
else
{
result
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Prefix
(
"proxy"
)
.
Resource
(
"nodes"
)
.
Name
(
fmt
.
Sprintf
(
"%v:%v"
,
node
,
ports
.
KubeletPort
))
.
Suffix
(
endpoint
)
.
Do
()
}
finished
<-
struct
{}{}
}()
select
{
...
...
test/e2e/instrumentation/monitoring/influxdb.go
View file @
32675e6f
...
...
@@ -66,42 +66,21 @@ var (
// Query sends a command to the server and returns the Response
func
Query
(
c
clientset
.
Interface
,
query
string
)
(
*
influxdb
.
Response
,
error
)
{
subResourceProxyAvailable
,
err
:=
framework
.
ServerVersionGTE
(
framework
.
SubResourceServiceAndNodeProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
nil
,
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
var
result
[]
byte
if
subResourceProxyAvailable
{
result
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
"kube-system"
)
.
Resource
(
"services"
)
.
Name
(
influxdbService
+
":api"
)
.
SubResource
(
"proxy"
)
.
Suffix
(
"query"
)
.
Param
(
"q"
,
query
)
.
Param
(
"db"
,
influxdbDatabaseName
)
.
Param
(
"epoch"
,
"s"
)
.
Do
()
.
Raw
()
}
else
{
result
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Namespace
(
"kube-system"
)
.
Resource
(
"services"
)
.
Name
(
influxdbService
+
":api"
)
.
Suffix
(
"query"
)
.
Param
(
"q"
,
query
)
.
Param
(
"db"
,
influxdbDatabaseName
)
.
Param
(
"epoch"
,
"s"
)
.
Do
()
.
Raw
()
}
result
,
err
:=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
"kube-system"
)
.
Resource
(
"services"
)
.
Name
(
influxdbService
+
":api"
)
.
SubResource
(
"proxy"
)
.
Suffix
(
"query"
)
.
Param
(
"q"
,
query
)
.
Param
(
"db"
,
influxdbDatabaseName
)
.
Param
(
"epoch"
,
"s"
)
.
Do
()
.
Raw
()
if
err
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
...
...
test/e2e/kubectl/kubectl.go
View file @
32675e6f
...
...
@@ -1990,34 +1990,19 @@ func getUDData(jpgExpected string, ns string) func(clientset.Interface, string)
// getUDData validates data.json in the update-demo (returns nil if data is ok).
return
func
(
c
clientset
.
Interface
,
podID
string
)
error
{
framework
.
Logf
(
"validating pod %s"
,
podID
)
subResourceProxyAvailable
,
err
:=
framework
.
ServerVersionGTE
(
framework
.
SubResourcePodProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
var
body
[]
byte
if
subResourceProxyAvailable
{
body
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
podID
)
.
Suffix
(
"data.json"
)
.
Do
()
.
Raw
()
}
else
{
body
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Prefix
(
"proxy"
)
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
Name
(
podID
)
.
Suffix
(
"data.json"
)
.
Do
()
.
Raw
()
}
body
,
err
:=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
podID
)
.
Suffix
(
"data.json"
)
.
Do
()
.
Raw
()
if
err
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
framework
.
Failf
(
"Failed to retrieve data from container: %v"
,
err
)
...
...
test/e2e/network/dns.go
View file @
32675e6f
...
...
@@ -169,35 +169,20 @@ func assertFilesContain(fileNames []string, fileDir string, pod *v1.Pod, client
framework
.
ExpectNoError
(
wait
.
Poll
(
time
.
Second
*
10
,
time
.
Second
*
600
,
func
()
(
bool
,
error
)
{
failed
=
[]
string
{}
subResourceProxyAvailable
,
err
:=
framework
.
ServerVersionGTE
(
framework
.
SubResourcePodProxyVersion
,
client
.
Discovery
())
if
err
!=
nil
{
return
false
,
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
var
contents
[]
byte
for
_
,
fileName
:=
range
fileNames
{
if
subResourceProxyAvailable
{
contents
,
err
=
client
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
pod
.
Namespace
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
pod
.
Name
)
.
Suffix
(
fileDir
,
fileName
)
.
Do
()
.
Raw
()
}
else
{
contents
,
err
=
client
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Resource
(
"pods"
)
.
Namespace
(
pod
.
Namespace
)
.
Name
(
pod
.
Name
)
.
Suffix
(
fileDir
,
fileName
)
.
Do
()
.
Raw
()
}
contents
,
err
:=
client
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
pod
.
Namespace
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
pod
.
Name
)
.
Suffix
(
fileDir
,
fileName
)
.
Do
()
.
Raw
()
if
err
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
framework
.
Failf
(
"Unable to read %s from pod %s: %v"
,
fileName
,
pod
.
Name
,
err
)
...
...
test/e2e/pre_stop.go
View file @
32675e6f
...
...
@@ -121,34 +121,20 @@ func testPreStop(c clientset.Interface, ns string) {
// Validate that the server received the web poke.
err
=
wait
.
Poll
(
time
.
Second
*
5
,
time
.
Second
*
60
,
func
()
(
bool
,
error
)
{
subResourceProxyAvailable
,
err
:=
framework
.
ServerVersionGTE
(
framework
.
SubResourcePodProxyVersion
,
c
.
Discovery
())
if
err
!=
nil
{
return
false
,
err
}
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
var
body
[]
byte
if
subResourceProxyAvailable
{
body
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
podDescr
.
Name
)
.
Suffix
(
"read"
)
.
DoRaw
()
}
else
{
body
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Prefix
(
"proxy"
)
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
Name
(
podDescr
.
Name
)
.
Suffix
(
"read"
)
.
DoRaw
()
}
body
,
err
=
c
.
CoreV1
()
.
RESTClient
()
.
Get
()
.
Context
(
ctx
)
.
Namespace
(
ns
)
.
Resource
(
"pods"
)
.
SubResource
(
"proxy"
)
.
Name
(
podDescr
.
Name
)
.
Suffix
(
"read"
)
.
DoRaw
()
if
err
!=
nil
{
if
ctx
.
Err
()
!=
nil
{
framework
.
Failf
(
"Error validating prestop: %v"
,
err
)
...
...
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