From 5e379e429c4dd76ac4e01ff42ed1581a3a6e2400 Mon Sep 17 00:00:00 2001 From: wenxuanW Date: Wed, 29 May 2024 18:16:47 -0700 Subject: [PATCH] Rename ARM_BASE_URL --- cluster-autoscaler/cloudprovider/azure/azure_client.go | 8 ++++---- cluster-autoscaler/cloudprovider/azure/azure_config.go | 6 +++--- .../cloudprovider/azure/azure_manager_test.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cluster-autoscaler/cloudprovider/azure/azure_client.go b/cluster-autoscaler/cloudprovider/azure/azure_client.go index 98b48aa2c635..4928670f913c 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_client.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_client.go @@ -205,9 +205,9 @@ func getAgentpoolClientRetryOptions(cfg *Config) azurecore_policy.RetryOptions { func newAgentpoolClient(cfg *Config) (AgentPoolsClient, error) { retryOptions := getAgentpoolClientRetryOptions(cfg) - if cfg.ARMBaseURL != "" { - klog.V(10).Infof("Using ARMBaseURL to create agent pool client") - return newAgentpoolClientWithConfig(cfg.SubscriptionID, nil, cfg.ARMBaseURL, "UNKNOWN", retryOptions) + if cfg.ARMBaseURLForAPClient != "" { + klog.V(10).Infof("Using ARMBaseURLForAPClient to create agent pool client") + return newAgentpoolClientWithConfig(cfg.SubscriptionID, nil, cfg.ARMBaseURLForAPClient, "UNKNOWN", retryOptions) } return newAgentpoolClientWithPublicEndpoint(cfg, retryOptions) @@ -236,7 +236,7 @@ func newAgentpoolClientWithConfig(subscriptionID string, cred azcore.TokenCreden return nil, fmt.Errorf("failed to init cluster agent pools client: %w", err) } - klog.V(10).Infof("Successfully created agent pool client with ARMBaseURL") + klog.V(10).Infof("Successfully created agent pool client with ARMBaseURLForAPClient") return agentPoolsClient, nil } diff --git a/cluster-autoscaler/cloudprovider/azure/azure_config.go b/cluster-autoscaler/cloudprovider/azure/azure_config.go index 95c849f8d716..aa366f3a6e5d 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_config.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_config.go @@ -94,9 +94,9 @@ type Config struct { ClusterResourceGroup string `json:"clusterResourceGroup" yaml:"clusterResourceGroup"` VMType string `json:"vmType" yaml:"vmType"` - // ARMBaseURL is the URL to use for operations for the VMs pool. + // ARMBaseURLForAPClient is the URL to use for operations for the VMs pool. // It can override the default public ARM endpoint for VMs pool scale operations. - ARMBaseURL string `json:"armBaseURL" yaml:"armBaseURL"` + ARMBaseURLForAPClient string `json:"armBaseURLForAPClient" yaml:"armBaseURLForAPClient"` // AuthMethod determines how to authorize requests for the Azure // cloud. Valid options are "principal" (= the traditional @@ -306,7 +306,7 @@ func BuildAzureConfig(configReader io.Reader) (*Config, error) { // always read the following from environment variables since azure.json doesn't have these fields cfg.ClusterName = os.Getenv("CLUSTER_NAME") cfg.ClusterResourceGroup = os.Getenv("ARM_CLUSTER_RESOURCE_GROUP") - cfg.ARMBaseURL = os.Getenv("ARM_BASE_URL") + cfg.ARMBaseURLForAPClient = os.Getenv("ARM_BASE_URL_FOR_AP_CLIENT") cfg.TrimSpace() diff --git a/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go b/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go index 6f26fb20598d..95e76041690d 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go @@ -354,7 +354,7 @@ func TestCreateAzureManagerWithNilConfig(t *testing.T) { ResourceGroup: "resourceGroup", ClusterName: "mycluster", ClusterResourceGroup: "myrg", - ARMBaseURL: "nodeprovisioner-svc.nodeprovisioner.svc.cluster.local", + ARMBaseURLForAPClient: "nodeprovisioner-svc.nodeprovisioner.svc.cluster.local", VMType: "vmss", AADClientID: "aadClientId", AADClientSecret: "aadClientSecret", @@ -454,7 +454,7 @@ func TestCreateAzureManagerWithNilConfig(t *testing.T) { t.Setenv("CLOUD_PROVIDER_RATE_LIMIT", "true") t.Setenv("CLUSTER_NAME", "mycluster") t.Setenv("ARM_CLUSTER_RESOURCE_GROUP", "myrg") - t.Setenv("ARM_BASE_URL", "nodeprovisioner-svc.nodeprovisioner.svc.cluster.local") + t.Setenv("ARM_BASE_URL_FOR_AP_CLIENT", "nodeprovisioner-svc.nodeprovisioner.svc.cluster.local") t.Run("environment variables correctly set", func(t *testing.T) { manager, err := createAzureManagerInternal(nil, cloudprovider.NodeGroupDiscoveryOptions{}, mockAzClient)