Skip to content

Commit

Permalink
Rename ARM_BASE_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxuan0923 committed May 30, 2024
1 parent 73f525c commit 5e379e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions cluster-autoscaler/cloudprovider/azure/azure_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions cluster-autoscaler/cloudprovider/azure/azure_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions cluster-autoscaler/cloudprovider/azure/azure_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5e379e4

Please sign in to comment.