Skip to content

Commit

Permalink
Disable response compression for k8s restAPI in client-go (#3866)
Browse files Browse the repository at this point in the history
* Disable response compression for k8s restAPI in client-go

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>

* Updating metrics server with the same parameters

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>

* Adding the change to changelog

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>

* Set default value to true for disable compression

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>

* Changing default value to true in adapter

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>

Signed-off-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>
Co-authored-by: Chaitanya Kuduvalli Ramachandra <chaitanya.r@ETC02Y77ZVJG5H.local>
  • Loading branch information
ckuduvalli and Chaitanya Kuduvalli Ramachandra authored Nov 21, 2022
1 parent f8ea5dd commit 7ffdf59
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ 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,
"Enable leader election for controller manager. "+
"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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7ffdf59

Please sign in to comment.