Skip to content

Commit

Permalink
Merge pull request #983 from skmatti/default-neg-fix
Browse files Browse the repository at this point in the history
Skip checking delete for default NEG
  • Loading branch information
k8s-ci-robot committed Jan 7, 2020
2 parents 7a2aeb9 + 613ce68 commit ad5e69b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/fuzz/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const (
HttpsProtocol = Protocol("HTTPS")
targetHTTPProxyResource = "targetHttpProxies"
targetHTTPSProxyResource = "targetHttpsProxies"
kubeSystemNS = "kube-system"
defaultHTTPBackend = "default-http-backend"
)

// Protocol specifies GCE loadbalancer protocol.
Expand Down Expand Up @@ -228,7 +230,7 @@ func (g *GCLB) CheckResourceDeletion(ctx context.Context, c cloud.Cloud, options
} else {
if options != nil && options.SkipDefaultBackend {
desc := utils.DescriptionFromString(bs.Description)
if desc.ServiceName == "kube-system/default-http-backend" {
if desc.ServiceName == fmt.Sprintf("%s/%s", kubeSystemNS, defaultHTTPBackend) {
continue
}
}
Expand All @@ -237,12 +239,20 @@ func (g *GCLB) CheckResourceDeletion(ctx context.Context, c cloud.Cloud, options
}
}
for k := range g.NetworkEndpointGroup {
_, err := c.BetaNetworkEndpointGroups().Get(ctx, &k)
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)
}
}
Expand Down

0 comments on commit ad5e69b

Please sign in to comment.