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
7059717c
Commit
7059717c
authored
Apr 26, 2016
by
Joe Finney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use zone from the test context for static IPs.
parent
64fbb4a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
google_compute.go
test/e2e/google_compute.go
+13
-3
No files found.
test/e2e/google_compute.go
View file @
7059717c
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
)
)
...
@@ -38,13 +39,17 @@ func createGCEStaticIP(name string) (string, error) {
...
@@ -38,13 +39,17 @@ func createGCEStaticIP(name string) (string, error) {
// NAME REGION ADDRESS STATUS
// NAME REGION ADDRESS STATUS
// test-static-ip us-central1 104.197.143.7 RESERVED
// test-static-ip us-central1 104.197.143.7 RESERVED
glog
.
Infof
(
"Creating static IP with name %q in project %q"
,
name
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
)
var
outputBytes
[]
byte
var
outputBytes
[]
byte
var
err
error
var
err
error
region
,
err
:=
gce
.
GetGCERegion
(
framework
.
TestContext
.
CloudConfig
.
Zone
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to convert zone to region: %v"
,
err
)
}
glog
.
Infof
(
"Creating static IP with name %q in project %q in region %q"
,
name
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
region
)
for
attempts
:=
0
;
attempts
<
4
;
attempts
++
{
for
attempts
:=
0
;
attempts
<
4
;
attempts
++
{
outputBytes
,
err
=
exec
.
Command
(
"gcloud"
,
"compute"
,
"addresses"
,
"create"
,
outputBytes
,
err
=
exec
.
Command
(
"gcloud"
,
"compute"
,
"addresses"
,
"create"
,
name
,
"--project"
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
name
,
"--project"
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
"--region"
,
"us-central1"
,
"-q"
)
.
CombinedOutput
()
"--region"
,
region
,
"-q"
)
.
CombinedOutput
()
if
err
==
nil
{
if
err
==
nil
{
break
break
}
}
...
@@ -77,9 +82,14 @@ func deleteGCEStaticIP(name string) error {
...
@@ -77,9 +82,14 @@ func deleteGCEStaticIP(name string) error {
// NAME REGION ADDRESS STATUS
// NAME REGION ADDRESS STATUS
// test-static-ip us-central1 104.197.143.7 RESERVED
// test-static-ip us-central1 104.197.143.7 RESERVED
region
,
err
:=
gce
.
GetGCERegion
(
framework
.
TestContext
.
CloudConfig
.
Zone
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to convert zone to region: %v"
,
err
)
}
glog
.
Infof
(
"Deleting static IP with name %q in project %q in region %q"
,
name
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
region
)
outputBytes
,
err
:=
exec
.
Command
(
"gcloud"
,
"compute"
,
"addresses"
,
"delete"
,
outputBytes
,
err
:=
exec
.
Command
(
"gcloud"
,
"compute"
,
"addresses"
,
"delete"
,
name
,
"--project"
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
name
,
"--project"
,
framework
.
TestContext
.
CloudConfig
.
ProjectID
,
"--region"
,
"us-central1"
,
"-q"
)
.
CombinedOutput
()
"--region"
,
region
,
"-q"
)
.
CombinedOutput
()
if
err
!=
nil
{
if
err
!=
nil
{
// Ditch the error, since the stderr in the output is what actually contains
// Ditch the error, since the stderr in the output is what actually contains
// any useful info.
// any useful info.
...
...
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