From d5c59a69186bf942c13ff49f06f736c0bd36b512 Mon Sep 17 00:00:00 2001 From: Minhan Xia Date: Tue, 9 Jun 2020 10:34:56 -0700 Subject: [PATCH] Skip waiting for NEGs to be deleted if SkipBackends is set in GCLBDeleteOptions --- pkg/fuzz/gcp.go | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pkg/fuzz/gcp.go b/pkg/fuzz/gcp.go index ec20486266..f71565fdd2 100644 --- a/pkg/fuzz/gcp.go +++ b/pkg/fuzz/gcp.go @@ -244,23 +244,24 @@ func (g *GCLB) CheckResourceDeletion(ctx context.Context, c cloud.Cloud, options resources = append(resources, k) } } - } - for k := range g.NetworkEndpointGroup { - ns, err := c.BetaNetworkEndpointGroups().Get(ctx, &k) - if err != nil { - if err.(*googleapi.Error) == nil || err.(*googleapi.Error).Code != http.StatusNotFound { - return fmt.Errorf("NetworkEndpointGroup %s is not deleted/error to get: %s", k.Name, err) - } - } else { - // TODO(smatti): Add NEG description to make this less error prone. - // This is to ensure that ILB tests that use NEGs are not blocked on default NEG deletion. - // Also, the default NEG may not get recognized here if default http backend name is changed - // to cause truncation. - if options != nil && options.SkipDefaultBackend && - strings.Contains(ns.Name, fmt.Sprintf("%s-%s", kubeSystemNS, defaultHTTPBackend)) { - continue + + for k := range g.NetworkEndpointGroup { + ns, err := c.BetaNetworkEndpointGroups().Get(ctx, &k) + if err != nil { + if err.(*googleapi.Error) == nil || err.(*googleapi.Error).Code != http.StatusNotFound { + return fmt.Errorf("NetworkEndpointGroup %s is not deleted/error to get: %s", k.Name, err) + } + } else { + // TODO(smatti): Add NEG description to make this less error prone. + // This is to ensure that ILB tests that use NEGs are not blocked on default NEG deletion. + // Also, the default NEG may not get recognized here if default http backend name is changed + // to cause truncation. + if options != nil && options.SkipDefaultBackend && + strings.Contains(ns.Name, fmt.Sprintf("%s-%s", kubeSystemNS, defaultHTTPBackend)) { + continue + } + resources = append(resources, k) } - resources = append(resources, k) } }