Skip to content

Commit e0f9438

Browse files
authored
Merge pull request #1080 from judemars/add_endpoint_version
add beta/v1 suffix to passed-in compute endpoint
2 parents cd8a6d2 + b6ad902 commit e0f9438

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pkg/gce-cloud-provider/compute/gce.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ func createBetaCloudService(ctx context.Context, vendorVersion string, tokenSour
163163

164164
computeOpts := []option.ClientOption{option.WithHTTPClient(client)}
165165
if computeEndpoint != "" {
166-
computeOpts = append(computeOpts, option.WithEndpoint(computeEndpoint))
166+
betaEndpoint := fmt.Sprintf("%s/compute/beta/", computeEndpoint)
167+
computeOpts = append(computeOpts, option.WithEndpoint(betaEndpoint))
167168
}
168169
service, err := computebeta.NewService(ctx, computeOpts...)
169170
if err != nil {
@@ -186,7 +187,8 @@ func createCloudServiceWithDefaultServiceAccount(ctx context.Context, vendorVers
186187

187188
computeOpts := []option.ClientOption{option.WithHTTPClient(client)}
188189
if computeEndpoint != "" {
189-
computeOpts = append(computeOpts, option.WithEndpoint(computeEndpoint))
190+
v1Endpoint := fmt.Sprintf("%s/compute/v1/", computeEndpoint)
191+
computeOpts = append(computeOpts, option.WithEndpoint(v1Endpoint))
190192
}
191193
service, err := compute.NewService(ctx, computeOpts...)
192194
if err != nil {

test/e2e/tests/single_zone_e2e_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ var _ = Describe("GCE PD CSI Driver", func() {
11501150
Expect(err.Error()).To(ContainSubstring("no such host"), "expected error when passed invalid compute url")
11511151

11521152
// Create new driver and client w/ valid, passed-in endpoint
1153-
tcValid, err := testutils.GCEClientAndDriverSetup(i, "https://compute.googleapis.com/compute/v1/")
1153+
tcValid, err := testutils.GCEClientAndDriverSetup(i, "https://compute.googleapis.com")
11541154
if err != nil {
11551155
klog.Fatalf("Failed to set up Test Context for instance %v: %v", i.GetName(), err)
11561156
}

0 commit comments

Comments
 (0)