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
692e440d
Commit
692e440d
authored
Oct 21, 2016
by
bprashanth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate static-ip through cloudprovider library instead of gcloud
parent
7a03564b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
ingress.go
test/e2e/ingress.go
+1
-0
ingress_utils.go
test/e2e/ingress_utils.go
+13
-15
No files found.
test/e2e/ingress.go
View file @
692e440d
...
...
@@ -119,6 +119,7 @@ var _ = framework.KubeDescribe("Loadbalancing: L7 [Feature:Ingress]", func() {
})
It
(
"shoud create ingress with given static-ip "
,
func
()
{
// ip released when the rest of lb resources are deleted in cleanupGCE
ip
:=
gceController
.
staticIP
(
ns
)
By
(
fmt
.
Sprintf
(
"allocated static ip %v: %v through the GCE cloud provider"
,
ns
,
ip
))
...
...
test/e2e/ingress_utils.go
View file @
692e440d
...
...
@@ -590,24 +590,22 @@ func (cont *GCEIngressController) init() {
}
}
// staticIP allocates a random static ip with the given name. Returns a string
// representation of the ip. Caller is expected to manage cleanup of the ip.
func
(
cont
*
GCEIngressController
)
staticIP
(
name
string
)
string
{
ExpectNoError
(
gcloudCreate
(
"addresses"
,
name
,
cont
.
cloud
.
ProjectID
,
"--global"
))
cont
.
staticIPName
=
name
ipList
:=
[]
compute
.
Address
{}
if
pollErr
:=
wait
.
PollImmediate
(
5
*
time
.
Second
,
cloudResourcePollTimeout
,
func
()
(
bool
,
error
)
{
gcloudList
(
"addresses"
,
name
,
cont
.
cloud
.
ProjectID
,
&
ipList
)
if
len
(
ipList
)
!=
1
{
framework
.
Logf
(
"Failed to find static ip %v even though create call succeeded, found ips %+v"
,
name
,
ipList
)
return
false
,
nil
}
return
true
,
nil
});
pollErr
!=
nil
{
if
err
:=
gcloudDelete
(
"addresses"
,
name
,
cont
.
cloud
.
ProjectID
,
"--global"
);
err
==
nil
{
framework
.
Logf
(
"Failed to get AND delete address %v even though create call succeeded"
,
name
)
gceCloud
:=
cont
.
cloud
.
Provider
.
(
*
gcecloud
.
GCECloud
)
ip
,
err
:=
gceCloud
.
ReserveGlobalStaticIP
(
name
,
""
)
if
err
!=
nil
{
if
delErr
:=
gceCloud
.
DeleteGlobalStaticIP
(
name
);
delErr
!=
nil
{
if
cont
.
isHTTPErrorCode
(
delErr
,
http
.
StatusNotFound
)
{
framework
.
Logf
(
"Static ip with name %v was not allocated, nothing to delete"
,
name
)
}
else
{
framework
.
Logf
(
"Failed to delete static ip %v: %v"
,
name
,
delErr
)
}
}
framework
.
Failf
(
"Failed to
find static ip %v even though create call succeeded, found ips %+v"
,
name
,
ipList
)
framework
.
Failf
(
"Failed to
allocated static ip %v: %v"
,
name
,
err
)
}
return
ip
List
[
0
]
.
Address
return
ip
.
Address
}
// gcloudList unmarshals json output of gcloud into given out interface.
...
...
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