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
605b106d
Commit
605b106d
authored
Jun 07, 2017
by
shashidharatd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made CleanupGCEResources explicitly take zone parameter
parent
783b940c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
service_util.go
test/e2e/framework/service_util.go
+10
-2
util.go
test/e2e/framework/util.go
+8
-4
service.go
test/e2e/service.go
+2
-2
No files found.
test/e2e/framework/service_util.go
View file @
605b106d
...
...
@@ -1300,9 +1300,17 @@ func VerifyServeHostnameServiceDown(c clientset.Interface, host string, serviceI
return
fmt
.
Errorf
(
"waiting for service to be down timed out"
)
}
func
CleanupServiceGCEResources
(
loadBalancerName
string
)
{
func
CleanupServiceResources
(
loadBalancerName
,
zone
string
)
{
if
TestContext
.
Provider
==
"gce"
||
TestContext
.
Provider
==
"gke"
{
CleanupServiceGCEResources
(
loadBalancerName
,
zone
)
}
// TODO: we need to add this function with other cloud providers, if there is a need.
}
func
CleanupServiceGCEResources
(
loadBalancerName
,
zone
string
)
{
if
pollErr
:=
wait
.
Poll
(
5
*
time
.
Second
,
LoadBalancerCleanupTimeout
,
func
()
(
bool
,
error
)
{
if
err
:=
CleanupGCEResources
(
loadBalancerName
);
err
!=
nil
{
if
err
:=
CleanupGCEResources
(
loadBalancerName
,
zone
);
err
!=
nil
{
Logf
(
"Still waiting for glbc to cleanup: %v"
,
err
)
return
false
,
nil
}
...
...
test/e2e/framework/util.go
View file @
605b106d
...
...
@@ -5158,21 +5158,25 @@ func (p *E2ETestNodePreparer) CleanupNodes() error {
// CleanupGCEResources cleans up GCE Service Type=LoadBalancer resources with
// the given name. The name is usually the UUID of the Service prefixed with an
// alpha-numeric character ('a') to work around cloudprovider rules.
func
CleanupGCEResources
(
loadBalancerName
string
)
(
retErr
error
)
{
func
CleanupGCEResources
(
loadBalancerName
,
zone
string
)
(
retErr
error
)
{
gceCloud
,
err
:=
GetGCECloud
()
if
err
!=
nil
{
return
err
}
region
,
err
:=
gcecloud
.
GetGCERegion
(
zone
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error parsing GCE/GKE region from zone %q: %v"
,
zone
,
err
)
}
if
err
:=
gceCloud
.
DeleteFirewall
(
loadBalancerName
);
err
!=
nil
&&
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
retErr
=
err
}
if
err
:=
gceCloud
.
DeleteRegionForwardingRule
(
loadBalancerName
,
gceCloud
.
Region
()
);
err
!=
nil
&&
if
err
:=
gceCloud
.
DeleteRegionForwardingRule
(
loadBalancerName
,
region
);
err
!=
nil
&&
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
retErr
=
fmt
.
Errorf
(
"%v
\n
%v"
,
retErr
,
err
)
}
if
err
:=
gceCloud
.
DeleteRegionAddress
(
loadBalancerName
,
gceCloud
.
Region
()
);
err
!=
nil
&&
if
err
:=
gceCloud
.
DeleteRegionAddress
(
loadBalancerName
,
region
);
err
!=
nil
&&
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
retErr
=
fmt
.
Errorf
(
"%v
\n
%v"
,
retErr
,
err
)
}
...
...
@@ -5185,7 +5189,7 @@ func CleanupGCEResources(loadBalancerName string) (retErr error) {
if
hc
!=
nil
{
hcNames
=
append
(
hcNames
,
hc
.
Name
)
}
if
err
:=
gceCloud
.
DeleteExternalTargetPoolAndChecks
(
loadBalancerName
,
gceCloud
.
Region
()
,
hcNames
...
);
err
!=
nil
&&
if
err
:=
gceCloud
.
DeleteExternalTargetPoolAndChecks
(
loadBalancerName
,
region
,
hcNames
...
);
err
!=
nil
&&
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
retErr
=
fmt
.
Errorf
(
"%v
\n
%v"
,
retErr
,
err
)
}
...
...
test/e2e/service.go
View file @
605b106d
...
...
@@ -57,7 +57,7 @@ var _ = framework.KubeDescribe("Services", func() {
}
for
_
,
lb
:=
range
serviceLBNames
{
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
CleanupServiceGCEResources
(
lb
)
framework
.
CleanupServiceGCEResources
(
lb
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
}
//reset serviceLBNames
serviceLBNames
=
[]
string
{}
...
...
@@ -1266,7 +1266,7 @@ var _ = framework.KubeDescribe("ESIPP [Slow]", func() {
}
for
_
,
lb
:=
range
serviceLBNames
{
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
CleanupServiceGCEResources
(
lb
)
framework
.
CleanupServiceGCEResources
(
lb
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
}
//reset serviceLBNames
serviceLBNames
=
[]
string
{}
...
...
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