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
9bb962e2
Commit
9bb962e2
authored
Mar 09, 2018
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[e2e service] Fix CleanupGCEResources for regional test
parent
40143fd6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
service_util.go
test/e2e/framework/service_util.go
+4
-4
util.go
test/e2e/framework/util.go
+7
-4
network_tiers.go
test/e2e/network/network_tiers.go
+1
-1
service.go
test/e2e/network/service.go
+2
-2
No files found.
test/e2e/framework/service_util.go
View file @
9bb962e2
...
@@ -1368,17 +1368,17 @@ func VerifyServeHostnameServiceDown(c clientset.Interface, host string, serviceI
...
@@ -1368,17 +1368,17 @@ func VerifyServeHostnameServiceDown(c clientset.Interface, host string, serviceI
return
fmt
.
Errorf
(
"waiting for service to be down timed out"
)
return
fmt
.
Errorf
(
"waiting for service to be down timed out"
)
}
}
func
CleanupServiceResources
(
c
clientset
.
Interface
,
loadBalancerName
,
zone
string
)
{
func
CleanupServiceResources
(
c
clientset
.
Interface
,
loadBalancerName
,
region
,
zone
string
)
{
if
TestContext
.
Provider
==
"gce"
||
TestContext
.
Provider
==
"gke"
{
if
TestContext
.
Provider
==
"gce"
||
TestContext
.
Provider
==
"gke"
{
CleanupServiceGCEResources
(
c
,
loadBalancerName
,
zone
)
CleanupServiceGCEResources
(
c
,
loadBalancerName
,
region
,
zone
)
}
}
// TODO: we need to add this function with other cloud providers, if there is a need.
// TODO: we need to add this function with other cloud providers, if there is a need.
}
}
func
CleanupServiceGCEResources
(
c
clientset
.
Interface
,
loadBalancerName
,
zone
string
)
{
func
CleanupServiceGCEResources
(
c
clientset
.
Interface
,
loadBalancerName
,
region
,
zone
string
)
{
if
pollErr
:=
wait
.
Poll
(
5
*
time
.
Second
,
LoadBalancerCleanupTimeout
,
func
()
(
bool
,
error
)
{
if
pollErr
:=
wait
.
Poll
(
5
*
time
.
Second
,
LoadBalancerCleanupTimeout
,
func
()
(
bool
,
error
)
{
if
err
:=
CleanupGCEResources
(
c
,
loadBalancerName
,
zone
);
err
!=
nil
{
if
err
:=
CleanupGCEResources
(
c
,
loadBalancerName
,
region
,
zone
);
err
!=
nil
{
Logf
(
"Still waiting for glbc to cleanup: %v"
,
err
)
Logf
(
"Still waiting for glbc to cleanup: %v"
,
err
)
return
false
,
nil
return
false
,
nil
}
}
...
...
test/e2e/framework/util.go
View file @
9bb962e2
...
@@ -4861,14 +4861,17 @@ func GetClusterID(c clientset.Interface) (string, error) {
...
@@ -4861,14 +4861,17 @@ func GetClusterID(c clientset.Interface) (string, error) {
// CleanupGCEResources cleans up GCE Service Type=LoadBalancer resources with
// CleanupGCEResources cleans up GCE Service Type=LoadBalancer resources with
// the given name. The name is usually the UUID of the Service prefixed with an
// the given name. The name is usually the UUID of the Service prefixed with an
// alpha-numeric character ('a') to work around cloudprovider rules.
// alpha-numeric character ('a') to work around cloudprovider rules.
func
CleanupGCEResources
(
c
clientset
.
Interface
,
loadBalancerName
,
zone
string
)
(
retErr
error
)
{
func
CleanupGCEResources
(
c
clientset
.
Interface
,
loadBalancerName
,
region
,
zone
string
)
(
retErr
error
)
{
gceCloud
,
err
:=
GetGCECloud
()
gceCloud
,
err
:=
GetGCECloud
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
region
,
err
:=
gcecloud
.
GetGCERegion
(
zone
)
if
region
==
""
{
if
err
!=
nil
{
// Attempt to parse region from zone if no region is given.
return
fmt
.
Errorf
(
"error parsing GCE/GKE region from zone %q: %v"
,
zone
,
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
(
gcecloud
.
MakeFirewallName
(
loadBalancerName
));
err
!=
nil
&&
if
err
:=
gceCloud
.
DeleteFirewall
(
gcecloud
.
MakeFirewallName
(
loadBalancerName
));
err
!=
nil
&&
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
!
IsGoogleAPIHTTPErrorCode
(
err
,
http
.
StatusNotFound
)
{
...
...
test/e2e/network/network_tiers.go
View file @
9bb962e2
...
@@ -53,7 +53,7 @@ var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
...
@@ -53,7 +53,7 @@ var _ = SIGDescribe("Services [Feature:GCEAlphaFeature][Slow]", func() {
}
}
for
_
,
lb
:=
range
serviceLBNames
{
for
_
,
lb
:=
range
serviceLBNames
{
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Region
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
}
}
//reset serviceLBNames
//reset serviceLBNames
serviceLBNames
=
[]
string
{}
serviceLBNames
=
[]
string
{}
...
...
test/e2e/network/service.go
View file @
9bb962e2
...
@@ -61,7 +61,7 @@ var _ = SIGDescribe("Services", func() {
...
@@ -61,7 +61,7 @@ var _ = SIGDescribe("Services", func() {
}
}
for
_
,
lb
:=
range
serviceLBNames
{
for
_
,
lb
:=
range
serviceLBNames
{
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Region
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
}
}
//reset serviceLBNames
//reset serviceLBNames
serviceLBNames
=
[]
string
{}
serviceLBNames
=
[]
string
{}
...
@@ -1561,7 +1561,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
...
@@ -1561,7 +1561,7 @@ var _ = SIGDescribe("ESIPP [Slow] [DisabledForLargeClusters]", func() {
}
}
for
_
,
lb
:=
range
serviceLBNames
{
for
_
,
lb
:=
range
serviceLBNames
{
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
Logf
(
"cleaning gce resource for %s"
,
lb
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
framework
.
CleanupServiceGCEResources
(
cs
,
lb
,
framework
.
TestContext
.
CloudConfig
.
Region
,
framework
.
TestContext
.
CloudConfig
.
Zone
)
}
}
//reset serviceLBNames
//reset serviceLBNames
serviceLBNames
=
[]
string
{}
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