Skip to content

Commit a7c3c9f

Browse files
committed
Fix ListZonesInRegion() after client BasePath change
This path fixes region Regex for listing zones. Compute client BasePath changed to compute.googleapis.com, but resource URI were left as www.googleapis.com
1 parent 5afc42d commit a7c3c9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

staging/src/k8s.io/legacy-cloud-providers/gce/gce_zones.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package gce
2020

2121
import (
2222
"context"
23+
"fmt"
2324
"strings"
2425

2526
compute "google.golang.org/api/compute/v1"
@@ -79,7 +80,9 @@ func (g *Cloud) ListZonesInRegion(region string) ([]*compute.Zone, error) {
7980
defer cancel()
8081

8182
mc := newZonesMetricContext("list", region)
82-
list, err := g.c.Zones().List(ctx, filter.Regexp("region", g.getRegionLink(region)))
83+
// Use regex match instead of an exact regional link constructed from getRegionalLink below.
84+
// See comments in issue kubernetes/kubernetes#87905
85+
list, err := g.c.Zones().List(ctx, filter.Regexp("region", fmt.Sprintf(".*/regions/%s", region)))
8386
if err != nil {
8487
return nil, mc.Observe(err)
8588
}

0 commit comments

Comments
 (0)