From 7ffdf59d15f989fa20728bf69c747f89710e44f5 Mon Sep 17 00:00:00 2001 From: ckuduvalli <53260429+ckuduvalli@users.noreply.github.com> Date: Mon, 21 Nov 2022 15:20:50 +0530 Subject: [PATCH] Disable response compression for k8s restAPI in client-go (#3866) * Disable response compression for k8s restAPI in client-go Signed-off-by: Chaitanya Kuduvalli Ramachandra * Updating metrics server with the same parameters Signed-off-by: Chaitanya Kuduvalli Ramachandra * Adding the change to changelog Signed-off-by: Chaitanya Kuduvalli Ramachandra * Set default value to true for disable compression Signed-off-by: Chaitanya Kuduvalli Ramachandra * Changing default value to true in adapter Signed-off-by: Chaitanya Kuduvalli Ramachandra Signed-off-by: Chaitanya Kuduvalli Ramachandra Co-authored-by: Chaitanya Kuduvalli Ramachandra --- CHANGELOG.md | 1 + adapter/main.go | 3 +++ main.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 877da376b4f..2e522cbb368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio ### New +- **General**: Disable response compression for k8s restAPI in client-go ([#3863](https://github.com/kedacore/keda/issues/3863)). Kubernetes issue for reference (https://github.com/kubernetes/kubernetes/issues/112296) - **General**: Expand Prometheus metric with label "ScalerName" to distinguish different triggers. The scaleName is defined per Trigger.Name ([#3588](https://github.com/kedacore/keda/issues/3588)) - **General:** Introduce new Loki Scaler ([#3699](https://github.com/kedacore/keda/issues/3699)) - **General**: Add ratelimitting parameters to KEDA manager to allow override of client defaults ([#3730](https://github.com/kedacore/keda/issues/2920)) diff --git a/adapter/main.go b/adapter/main.go index 1887c0f4d72..f26d0b71416 100644 --- a/adapter/main.go +++ b/adapter/main.go @@ -67,6 +67,7 @@ var ( adapterClientRequestQPS float32 adapterClientRequestBurst int metricsAPIServerPort int + disableCompression bool ) func (a *Adapter) makeProvider(ctx context.Context, globalHTTPTimeout time.Duration, maxConcurrentReconciles int) (provider.MetricsProvider, <-chan struct{}, error) { @@ -75,6 +76,7 @@ func (a *Adapter) makeProvider(ctx context.Context, globalHTTPTimeout time.Durat if cfg != nil { cfg.QPS = adapterClientRequestQPS cfg.Burst = adapterClientRequestBurst + cfg.DisableCompression = disableCompression } if err != nil { @@ -209,6 +211,7 @@ func main() { cmd.Flags().StringVar(&prometheusMetricsPath, "metrics-path", "/metrics", "Set the path for the prometheus metrics endpoint") cmd.Flags().Float32Var(&adapterClientRequestQPS, "kube-api-qps", 20.0, "Set the QPS rate for throttling requests sent to the apiserver") cmd.Flags().IntVar(&adapterClientRequestBurst, "kube-api-burst", 30, "Set the burst for throttling requests sent to the apiserver") + cmd.Flags().BoolVar(&disableCompression, "disable-compression", true, "Disable response compression for k8s restAPI in client-go. ") if err := cmd.Flags().Parse(os.Args); err != nil { return } diff --git a/main.go b/main.go index 2c547f1493c..e7ba811375e 100644 --- a/main.go +++ b/main.go @@ -68,6 +68,7 @@ func main() { var probeAddr string var adapterClientRequestQPS float32 var adapterClientRequestBurst int + var disableCompression bool pflag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") pflag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") pflag.BoolVar(&enableLeaderElection, "leader-elect", false, @@ -75,6 +76,7 @@ func main() { "Enabling this will ensure there is only one active controller manager.") pflag.Float32Var(&adapterClientRequestQPS, "kube-api-qps", 20.0, "Set the QPS rate for throttling requests sent to the apiserver") pflag.IntVar(&adapterClientRequestBurst, "kube-api-burst", 30, "Set the burst for throttling requests sent to the apiserver") + pflag.BoolVar(&disableCompression, "disable-compression", true, "Disable response compression for k8s restAPI in client-go. ") opts := zap.Options{} opts.BindFlags(flag.CommandLine) pflag.CommandLine.AddGoFlagSet(flag.CommandLine) @@ -110,6 +112,7 @@ func main() { cfg := ctrl.GetConfigOrDie() cfg.QPS = adapterClientRequestQPS cfg.Burst = adapterClientRequestBurst + cfg.DisableCompression = disableCompression mgr, err := ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme,