Enable azure options for autoscaler
This commit is contained in:
		
							parent
							
								
									4cc7ac56b0
								
							
						
					
					
						commit
						8f7d35b4e0
					
				| 
						 | 
				
			
			@ -21,6 +21,7 @@ import (
 | 
			
		|||
 | 
			
		||||
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
 | 
			
		||||
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws"
 | 
			
		||||
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/azure"
 | 
			
		||||
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/gce"
 | 
			
		||||
	"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/kubemark"
 | 
			
		||||
	"k8s.io/client-go/informers"
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +113,30 @@ func (b CloudProviderBuilder) Build(discoveryOpts cloudprovider.NodeGroupDiscove
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if b.cloudProviderFlag == "azure" {
 | 
			
		||||
		var azureManager *azure.AzureManager
 | 
			
		||||
		var azureError error
 | 
			
		||||
		if b.cloudConfig != "" {
 | 
			
		||||
			glog.Info("Creating Azure Manager using cloud-config file: %v", b.cloudConfig)
 | 
			
		||||
			config, fileErr := os.Open(b.cloudConfig)
 | 
			
		||||
			if fileErr != nil {
 | 
			
		||||
				glog.Fatalf("Couldn't open cloud provider configuration %s: %#v", b.cloudConfig, err)
 | 
			
		||||
			}
 | 
			
		||||
			defer config.Close()
 | 
			
		||||
			azureManager, azureError = azure.CreateAzureManager(config)
 | 
			
		||||
		} else {
 | 
			
		||||
			glog.Info("Creating Azure Manager with default configuration.")
 | 
			
		||||
			azureManager, azureError = azure.CreateAzureManager(nil)
 | 
			
		||||
		}
 | 
			
		||||
		if azureError != nil {
 | 
			
		||||
			glog.Fatalf("Failed to create Azure Manager: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
		cloudProvider, err = azure.BuildAzureCloudProvider(azureManager, nodeGroupsFlag, resourceLimiter)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			glog.Fatalf("Failed to create Azure cloud provider: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if b.cloudProviderFlag == kubemark.ProviderName {
 | 
			
		||||
		glog.V(1).Infof("Building kubemark cloud provider.")
 | 
			
		||||
		externalConfig, err := rest.InClusterConfig()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ var (
 | 
			
		|||
	maxNodesTotal              = flag.Int("max-nodes-total", 0, "Maximum number of nodes in all node groups. Cluster autoscaler will not grow the cluster beyond this number.")
 | 
			
		||||
	coresTotal                 = flag.String("cores-total", minMaxFlagString(0, config.DefaultMaxClusterCores), "Minimum and maximum number of cores in cluster, in the format <min>:<max>. Cluster autoscaler will not scale the cluster beyond these numbers.")
 | 
			
		||||
	memoryTotal                = flag.String("memory-total", minMaxFlagString(0, config.DefaultMaxClusterMemory), "Minimum and maximum number of gigabytes of memory in cluster, in the format <min>:<max>. Cluster autoscaler will not scale the cluster beyond these numbers.")
 | 
			
		||||
	cloudProviderFlag          = flag.String("cloud-provider", "gce", "Cloud provider type. Allowed values: gce, aws, kubemark")
 | 
			
		||||
	cloudProviderFlag          = flag.String("cloud-provider", "gce", "Cloud provider type. Allowed values: gce, aws, azure, kubemark")
 | 
			
		||||
	maxEmptyBulkDeleteFlag     = flag.Int("max-empty-bulk-delete", 10, "Maximum number of empty nodes that can be deleted at the same time.")
 | 
			
		||||
	maxGracefulTerminationFlag = flag.Int("max-graceful-termination-sec", 10*60, "Maximum number of seconds CA waits for pod termination when trying to scale down a node.")
 | 
			
		||||
	maxTotalUnreadyPercentage  = flag.Float64("max-total-unready-percentage", 33, "Maximum percentage of unready nodes after which CA halts operations")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue