From 33521b41d415259515adb5f22d8cd0453f33ad03 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 2 Aug 2019 14:25:12 -0400 Subject: [PATCH] Disable gzip compression in core control plane components On local networks (such as the typical connection path between control plane components) gzip compression increases CPU use and end to end p99 latency rather than decreasing it. Disable compression within the control plane components like a 1.15 cluster would be configured. --- cmd/cloud-controller-manager/app/options/options.go | 1 + cmd/kube-apiserver/app/server.go | 3 +++ cmd/kube-controller-manager/app/options/options.go | 1 + cmd/kube-scheduler/app/options/options.go | 1 + pkg/cloudprovider/providers/openstack/openstack.go | 1 + 5 files changed, 7 insertions(+) diff --git a/cmd/cloud-controller-manager/app/options/options.go b/cmd/cloud-controller-manager/app/options/options.go index 205e5da99b3..ff3e5ef9cea 100644 --- a/cmd/cloud-controller-manager/app/options/options.go +++ b/cmd/cloud-controller-manager/app/options/options.go @@ -176,6 +176,7 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *cloudcontrollerconfig.Config, if err != nil { return err } + c.Kubeconfig.DisableCompression = true c.Kubeconfig.ContentConfig.ContentType = o.Generic.ClientConnection.ContentType c.Kubeconfig.QPS = o.Generic.ClientConnection.QPS c.Kubeconfig.Burst = int(o.Generic.ClientConnection.Burst) diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index 490dad60c18..8fc161ba62a 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -433,6 +433,9 @@ func buildGenericConfig( // cannot default to it in generic apiserver and need to explicitly // set it in kube-apiserver. genericConfig.LoopbackClientConfig.ContentConfig.ContentType = "application/vnd.kubernetes.protobuf" + // Disable compression for self-communication, since we are going to be + // on a fast local network + genericConfig.LoopbackClientConfig.DisableCompression = true kubeClientConfig := genericConfig.LoopbackClientConfig clientgoExternalClient, err := clientgoclientset.NewForConfig(kubeClientConfig) diff --git a/cmd/kube-controller-manager/app/options/options.go b/cmd/kube-controller-manager/app/options/options.go index 42e096456dd..dc21ec7ef0e 100644 --- a/cmd/kube-controller-manager/app/options/options.go +++ b/cmd/kube-controller-manager/app/options/options.go @@ -391,6 +391,7 @@ func (s KubeControllerManagerOptions) Config(allControllers []string, disabledBy if err != nil { return nil, err } + kubeconfig.DisableCompression = true kubeconfig.ContentConfig.ContentType = s.Generic.ClientConnection.ContentType kubeconfig.QPS = s.Generic.ClientConnection.QPS kubeconfig.Burst = int(s.Generic.ClientConnection.Burst) diff --git a/cmd/kube-scheduler/app/options/options.go b/cmd/kube-scheduler/app/options/options.go index c43ae2431e2..2a0886cbd61 100644 --- a/cmd/kube-scheduler/app/options/options.go +++ b/cmd/kube-scheduler/app/options/options.go @@ -313,6 +313,7 @@ func createClients(config componentbaseconfig.ClientConnectionConfiguration, mas return nil, nil, nil, err } + kubeConfig.DisableCompression = true kubeConfig.AcceptContentTypes = config.AcceptContentTypes kubeConfig.ContentType = config.ContentType kubeConfig.QPS = config.QPS diff --git a/pkg/cloudprovider/providers/openstack/openstack.go b/pkg/cloudprovider/providers/openstack/openstack.go index 8d2ccf0081b..96bae12e322 100644 --- a/pkg/cloudprovider/providers/openstack/openstack.go +++ b/pkg/cloudprovider/providers/openstack/openstack.go @@ -267,6 +267,7 @@ func createKubernetesClient(kubeconfigPath string) (*kubernetes.Clientset, error if err != nil { return nil, err } + cfg.DisableCompression = true client, err := kubernetes.NewForConfig(cfg) if err != nil {