Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore flags for setting QPS limit in CA #6405

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cluster-autoscaler/config/autoscaling_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,8 @@ type KubeClientOptions struct {
KubeConfigPath string
// APIContentType specifies type of requests sent to APIServer.
APIContentType string
// Burst setting for kubernetes client
KubeClientBurst int
// QPS setting for kubernetes client
KubeClientQPS float32
}
6 changes: 4 additions & 2 deletions cluster-autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ var (
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.")
kubeAPIContentType = flag.String("kube-api-content-type", "application/vnd.kubernetes.protobuf", "Content type of requests sent to apiserver.")
_ = flag.Int("kube-client-burst", rest.DefaultBurst, "Burst value for kubernetes client. (Deprecated, relay on APF for rate limiting)")
_ = flag.Float64("kube-client-qps", float64(rest.DefaultQPS), "QPS value for kubernetes client. (Deprecated, relay on APF for rate limiting)")
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.")
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.")
Expand Down Expand Up @@ -442,6 +442,8 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
// Create basic config from flags.
autoscalingOptions := createAutoscalingOptions()

autoscalingOptions.KubeClientOpts.KubeClientBurst = int(*kubeClientBurst)
autoscalingOptions.KubeClientOpts.KubeClientQPS = float32(*kubeClientQPS)
kubeClient := kube_util.CreateKubeClient(autoscalingOptions.KubeClientOpts)

// Informer transform to trim ManagedFields for memory efficiency.
Expand Down
2 changes: 2 additions & 0 deletions cluster-autoscaler/utils/kubernetes/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func getKubeConfig(opts config.KubeClientOptions) *rest.Config {
}
}

kubeConfig.QPS = opts.KubeClientQPS
kubeConfig.Burst = opts.KubeClientBurst
kubeConfig.ContentType = opts.APIContentType

return kubeConfig
Expand Down
Loading