From b8edbc915b82cc9a787d9a4c552a7f10939740c0 Mon Sep 17 00:00:00 2001 From: Spencer Hance Date: Thu, 2 Mar 2023 22:36:12 -0800 Subject: [PATCH] Make gce endpoint strings configurable. This will allow packages who import this to configure the endpoints to something like https://mydomain.com/compute/v1. These endpoints are only used for SelfLink(). --- pkg/cloud/utils.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/cloud/utils.go b/pkg/cloud/utils.go index 692fad54..9f62c65a 100644 --- a/pkg/cloud/utils.go +++ b/pkg/cloud/utils.go @@ -24,10 +24,10 @@ import ( "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta" ) -const ( - gaPrefix = "https://www.googleapis.com/compute/v1" - alphaPrefix = "https://www.googleapis.com/compute/alpha" - betaPrefix = "https://www.googleapis.com/compute/beta" +var ( + GAPrefix = "https://www.googleapis.com/compute/v1" + AlphaPrefix = "https://www.googleapis.com/compute/alpha" + BetaPrefix = "https://www.googleapis.com/compute/beta" ) // ResourceID identifies a GCE resource as parsed from compute resource URL. @@ -191,11 +191,11 @@ func SelfLink(ver meta.Version, project, resource string, key *meta.Key) string var prefix string switch ver { case meta.VersionAlpha: - prefix = alphaPrefix + prefix = AlphaPrefix case meta.VersionBeta: - prefix = betaPrefix + prefix = BetaPrefix case meta.VersionGA: - prefix = gaPrefix + prefix = GAPrefix default: prefix = "invalid-prefix" }