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
7da5bb31
Commit
7da5bb31
authored
Oct 24, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serve_hostnames: fix compilation
parent
0dc983a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
BUILD
test/soak/serve_hostnames/BUILD
+1
-0
serve_hostnames.go
test/soak/serve_hostnames/serve_hostnames.go
+15
-9
No files found.
test/soak/serve_hostnames/BUILD
View file @
7da5bb31
...
@@ -19,6 +19,7 @@ go_binary(
...
@@ -19,6 +19,7 @@ go_binary(
"//pkg/api/errors:go_default_library",
"//pkg/api/errors:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/client/unversioned/clientcmd:go_default_library",
"//pkg/client/unversioned/clientcmd:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/runtime:go_default_library",
"//pkg/util/intstr:go_default_library",
"//pkg/util/intstr:go_default_library",
...
...
test/soak/serve_hostnames/serve_hostnames.go
View file @
7da5bb31
...
@@ -34,6 +34,7 @@ import (
...
@@ -34,6 +34,7 @@ import (
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/unversioned"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/intstr"
...
@@ -89,7 +90,7 @@ func main() {
...
@@ -89,7 +90,7 @@ func main() {
var
nodes
*
api
.
NodeList
var
nodes
*
api
.
NodeList
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
nodeListTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
nodeListTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
nodes
,
err
=
c
.
Nodes
()
.
List
(
api
.
ListOptions
{})
nodes
,
err
=
c
lient
.
Nodes
()
.
List
(
api
.
ListOptions
{})
if
err
==
nil
{
if
err
==
nil
{
break
break
}
}
...
@@ -111,7 +112,7 @@ func main() {
...
@@ -111,7 +112,7 @@ func main() {
queries
:=
*
queriesAverage
*
len
(
nodes
.
Items
)
*
*
podsPerNode
queries
:=
*
queriesAverage
*
len
(
nodes
.
Items
)
*
*
podsPerNode
// Create the namespace
// Create the namespace
got
,
err
:=
c
.
Namespaces
()
.
Create
(
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
GenerateName
:
"serve-hostnames-"
}})
got
,
err
:=
c
lient
.
Namespaces
()
.
Create
(
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
GenerateName
:
"serve-hostnames-"
}})
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalf
(
"Failed to create namespace: %v"
,
err
)
glog
.
Fatalf
(
"Failed to create namespace: %v"
,
err
)
}
}
...
@@ -122,7 +123,7 @@ func main() {
...
@@ -122,7 +123,7 @@ func main() {
}
else
{
}
else
{
// wait until the namespace disappears
// wait until the namespace disappears
for
i
:=
0
;
i
<
int
(
namespaceDeleteTimeout
/
time
.
Second
);
i
++
{
for
i
:=
0
;
i
<
int
(
namespaceDeleteTimeout
/
time
.
Second
);
i
++
{
if
_
,
err
:=
c
.
Namespaces
()
.
Get
(
ns
);
err
!=
nil
{
if
_
,
err
:=
c
lient
.
Namespaces
()
.
Get
(
ns
);
err
!=
nil
{
if
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsNotFound
(
err
)
{
return
return
}
}
...
@@ -139,7 +140,7 @@ func main() {
...
@@ -139,7 +140,7 @@ func main() {
var
svc
*
api
.
Service
var
svc
*
api
.
Service
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
serviceCreateTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
serviceCreateTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
t
:=
time
.
Now
()
t
:=
time
.
Now
()
svc
,
err
=
c
.
Services
(
ns
)
.
Create
(
&
api
.
Service
{
svc
,
err
=
c
lient
.
Services
(
ns
)
.
Create
(
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"serve-hostnames"
,
Name
:
"serve-hostnames"
,
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -172,7 +173,7 @@ func main() {
...
@@ -172,7 +173,7 @@ func main() {
glog
.
Infof
(
"Cleaning up service %s/serve-hostnames"
,
ns
)
glog
.
Infof
(
"Cleaning up service %s/serve-hostnames"
,
ns
)
// Make several attempts to delete the service.
// Make several attempts to delete the service.
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
deleteTimeout
;
time
.
Sleep
(
1
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
deleteTimeout
;
time
.
Sleep
(
1
*
time
.
Second
)
{
if
err
:=
c
.
Services
(
ns
)
.
Delete
(
svc
.
Name
);
err
==
nil
{
if
err
:=
c
lient
.
Services
(
ns
)
.
Delete
(
svc
.
Name
,
nil
);
err
==
nil
{
return
return
}
}
glog
.
Warningf
(
"After %v unable to delete service %s/%s: %v"
,
time
.
Since
(
start
),
ns
,
svc
.
Name
,
err
)
glog
.
Warningf
(
"After %v unable to delete service %s/%s: %v"
,
time
.
Since
(
start
),
ns
,
svc
.
Name
,
err
)
...
@@ -189,7 +190,7 @@ func main() {
...
@@ -189,7 +190,7 @@ func main() {
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
podCreateTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
podCreateTimeout
;
time
.
Sleep
(
2
*
time
.
Second
)
{
glog
.
Infof
(
"Creating pod %s/%s on node %s"
,
ns
,
podName
,
node
.
Name
)
glog
.
Infof
(
"Creating pod %s/%s on node %s"
,
ns
,
podName
,
node
.
Name
)
t
:=
time
.
Now
()
t
:=
time
.
Now
()
_
,
err
=
c
.
Pods
(
ns
)
.
Create
(
&
api
.
Pod
{
_
,
err
=
c
lient
.
Pods
(
ns
)
.
Create
(
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
podName
,
Name
:
podName
,
Labels
:
map
[
string
]
string
{
Labels
:
map
[
string
]
string
{
...
@@ -225,7 +226,7 @@ func main() {
...
@@ -225,7 +226,7 @@ func main() {
// Make several attempts to delete the pods.
// Make several attempts to delete the pods.
for
_
,
podName
:=
range
podNames
{
for
_
,
podName
:=
range
podNames
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
deleteTimeout
;
time
.
Sleep
(
1
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
deleteTimeout
;
time
.
Sleep
(
1
*
time
.
Second
)
{
if
err
=
c
.
Pods
(
ns
)
.
Delete
(
podName
,
nil
);
err
==
nil
{
if
err
=
c
lient
.
Pods
(
ns
)
.
Delete
(
podName
,
nil
);
err
==
nil
{
break
break
}
}
glog
.
Warningf
(
"After %v failed to delete pod %s/%s: %v"
,
time
.
Since
(
start
),
ns
,
podName
,
err
)
glog
.
Warningf
(
"After %v failed to delete pod %s/%s: %v"
,
time
.
Since
(
start
),
ns
,
podName
,
err
)
...
@@ -237,7 +238,7 @@ func main() {
...
@@ -237,7 +238,7 @@ func main() {
for
_
,
podName
:=
range
podNames
{
for
_
,
podName
:=
range
podNames
{
var
pod
*
api
.
Pod
var
pod
*
api
.
Pod
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
podStartTimeout
;
time
.
Sleep
(
5
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
podStartTimeout
;
time
.
Sleep
(
5
*
time
.
Second
)
{
pod
,
err
=
c
.
Pods
(
ns
)
.
Get
(
podName
)
pod
,
err
=
c
lient
.
Pods
(
ns
)
.
Get
(
podName
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Warningf
(
"Get pod %s/%s failed, ignoring for %v: %v"
,
ns
,
podName
,
err
,
podStartTimeout
)
glog
.
Warningf
(
"Get pod %s/%s failed, ignoring for %v: %v"
,
ns
,
podName
,
err
,
podStartTimeout
)
continue
continue
...
@@ -253,7 +254,12 @@ func main() {
...
@@ -253,7 +254,12 @@ func main() {
}
}
}
}
proxyRequest
,
errProxy
:=
e2e
.
GetServicesProxyRequest
(
c
,
c
.
Get
())
rclient
,
err
:=
restclient
.
RESTClientFor
(
config
)
if
err
!=
nil
{
glog
.
Warningf
(
"Failed to build restclient: %v"
,
err
)
return
}
proxyRequest
,
errProxy
:=
e2e
.
GetServicesProxyRequest
(
client
,
rclient
.
Get
())
if
errProxy
!=
nil
{
if
errProxy
!=
nil
{
glog
.
Warningf
(
"Get services proxy request failed: %v"
,
errProxy
)
glog
.
Warningf
(
"Get services proxy request failed: %v"
,
errProxy
)
return
return
...
...
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