mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-27 19:40:29 +00:00
Merge pull request #52751 from MrHohn/e2e-service-cleanup-fix
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Fix GCE LB resource cleanup for service e2e tests. **What this PR does / why we need it**: Fix GCE LB resource cleanup logic. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #52347 **Special notes for your reviewer**: /assign @shyamjvs @nicksardo **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -4802,7 +4802,7 @@ func CleanupGCEResources(c clientset.Interface, loadBalancerName, zone string) (
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing GCE/GKE region from zone %q: %v", zone, err)
|
||||
}
|
||||
if err := gceCloud.DeleteFirewall(loadBalancerName); err != nil &&
|
||||
if err := gceCloud.DeleteFirewall(gcecloud.MakeFirewallName(loadBalancerName)); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = err
|
||||
}
|
||||
@@ -4815,7 +4815,12 @@ func CleanupGCEResources(c clientset.Interface, loadBalancerName, zone string) (
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
}
|
||||
var hcNames []string
|
||||
clusterID, err := GetClusterID(c)
|
||||
if err != nil {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
return
|
||||
}
|
||||
hcNames := []string{gcecloud.MakeNodesHealthCheckName(clusterID)}
|
||||
hc, getErr := gceCloud.GetHttpHealthCheck(loadBalancerName)
|
||||
if getErr != nil && !IsGoogleAPIHTTPErrorCode(getErr, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, getErr)
|
||||
@@ -4824,11 +4829,6 @@ func CleanupGCEResources(c clientset.Interface, loadBalancerName, zone string) (
|
||||
if hc != nil {
|
||||
hcNames = append(hcNames, hc.Name)
|
||||
}
|
||||
clusterID, err := GetClusterID(c)
|
||||
if err != nil {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
return
|
||||
}
|
||||
if err := gceCloud.DeleteExternalTargetPoolAndChecks(nil, loadBalancerName, region, clusterID, hcNames...); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
retErr = fmt.Errorf("%v\n%v", retErr, err)
|
||||
|
||||
Reference in New Issue
Block a user