diff --git a/cluster-autoscaler/cloudprovider/azure/azure_client.go b/cluster-autoscaler/cloudprovider/azure/azure_client.go index 98b48aa2c635..cdbb23ad14a1 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) diff --git a/cluster-autoscaler/cloudprovider/azure/azure_config.go b/cluster-autoscaler/cloudprovider/azure/azure_config.go index 67e1a42ef7e3..b2f880d29af3 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 @@ -309,7 +309,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 5b21bea9ad34..4df4bea86357 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_manager_test.go @@ -351,7 +351,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", @@ -451,7 +451,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)