allow setting kuberentes client burst and qps to avoid rate limiting
This commit is contained in:
		
							parent
							
								
									3b2e3db941
								
							
						
					
					
						commit
						cd26bcfe60
					
				|  | @ -168,6 +168,10 @@ type AutoscalingOptions struct { | ||||||
| 	ConcurrentGceRefreshes int | 	ConcurrentGceRefreshes int | ||||||
| 	// Path to kube configuration if available
 | 	// Path to kube configuration if available
 | ||||||
| 	KubeConfigPath string | 	KubeConfigPath string | ||||||
|  | 	// Burst setting for kubernetes client
 | ||||||
|  | 	KubeClientBurst int | ||||||
|  | 	// QPS setting for kubernetes client
 | ||||||
|  | 	KubeClientQPS float64 | ||||||
| 	// ClusterAPICloudConfigAuthoritative tells the Cluster API provider to treat the CloudConfig option as authoritative and
 | 	// ClusterAPICloudConfigAuthoritative tells the Cluster API provider to treat the CloudConfig option as authoritative and
 | ||||||
| 	// not use KubeConfigPath as a fallback when it is not provided.
 | 	// not use KubeConfigPath as a fallback when it is not provided.
 | ||||||
| 	ClusterAPICloudConfigAuthoritative bool | 	ClusterAPICloudConfigAuthoritative bool | ||||||
|  |  | ||||||
|  | @ -90,6 +90,8 @@ var ( | ||||||
| 	address                 = flag.String("address", ":8085", "The address to expose prometheus metrics.") | 	address                 = flag.String("address", ":8085", "The address to expose prometheus metrics.") | ||||||
| 	kubernetes              = flag.String("kubernetes", "", "Kubernetes master location. Leave blank for default") | 	kubernetes              = flag.String("kubernetes", "", "Kubernetes master location. Leave blank for default") | ||||||
| 	kubeConfigFile          = flag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information.") | 	kubeConfigFile          = flag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information.") | ||||||
|  | 	kubeClientBurst         = flag.Int("kube-client-burst", rest.DefaultBurst, "Burst value for kubernetes client.") | ||||||
|  | 	kubeClientQPS           = flag.Float64("kube-client-qps", float64(rest.DefaultQPS), "QPS value for kubernetes client.") | ||||||
| 	cloudConfig             = flag.String("cloud-config", "", "The path to the cloud provider configuration file.  Empty string for no configuration file.") | 	cloudConfig             = flag.String("cloud-config", "", "The path to the cloud provider configuration file.  Empty string for no configuration file.") | ||||||
| 	namespace               = flag.String("namespace", "kube-system", "Namespace in which cluster-autoscaler run.") | 	namespace               = flag.String("namespace", "kube-system", "Namespace in which cluster-autoscaler run.") | ||||||
| 	enforceNodeGroupMinSize = flag.Bool("enforce-node-group-min-size", false, "Should CA scale up the node group to the configured min size if needed.") | 	enforceNodeGroupMinSize = flag.Bool("enforce-node-group-min-size", false, "Should CA scale up the node group to the configured min size if needed.") | ||||||
|  | @ -290,6 +292,8 @@ func createAutoscalingOptions() config.AutoscalingOptions { | ||||||
| 		BalancingExtraIgnoredLabels:        *balancingIgnoreLabelsFlag, | 		BalancingExtraIgnoredLabels:        *balancingIgnoreLabelsFlag, | ||||||
| 		BalancingLabels:                    *balancingLabelsFlag, | 		BalancingLabels:                    *balancingLabelsFlag, | ||||||
| 		KubeConfigPath:                     *kubeConfigFile, | 		KubeConfigPath:                     *kubeConfigFile, | ||||||
|  | 		KubeClientBurst:                    *kubeClientBurst, | ||||||
|  | 		KubeClientQPS:                      *kubeClientQPS, | ||||||
| 		NodeDeletionDelayTimeout:           *nodeDeletionDelayTimeout, | 		NodeDeletionDelayTimeout:           *nodeDeletionDelayTimeout, | ||||||
| 		AWSUseStaticInstanceList:           *awsUseStaticInstanceList, | 		AWSUseStaticInstanceList:           *awsUseStaticInstanceList, | ||||||
| 		ConcurrentGceRefreshes:             *concurrentGceRefreshes, | 		ConcurrentGceRefreshes:             *concurrentGceRefreshes, | ||||||
|  | @ -362,7 +366,12 @@ func registerSignalHandlers(autoscaler core.Autoscaler) { | ||||||
| func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter) (core.Autoscaler, error) { | func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter) (core.Autoscaler, error) { | ||||||
| 	// Create basic config from flags.
 | 	// Create basic config from flags.
 | ||||||
| 	autoscalingOptions := createAutoscalingOptions() | 	autoscalingOptions := createAutoscalingOptions() | ||||||
| 	kubeClient := createKubeClient(getKubeConfig()) | 
 | ||||||
|  | 	kubeClientConfig := getKubeConfig() | ||||||
|  | 	kubeClientConfig.Burst = autoscalingOptions.KubeClientBurst | ||||||
|  | 	kubeClientConfig.QPS = float32(autoscalingOptions.KubeClientQPS) | ||||||
|  | 	kubeClient := createKubeClient(kubeClientConfig) | ||||||
|  | 
 | ||||||
| 	eventsKubeClient := createKubeClient(getKubeConfig()) | 	eventsKubeClient := createKubeClient(getKubeConfig()) | ||||||
| 
 | 
 | ||||||
| 	opts := core.AutoscalerOptions{ | 	opts := core.AutoscalerOptions{ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue