From 4e8d63982909b36b75e5bf83a8b4f3378c8e9582 Mon Sep 17 00:00:00 2001 From: Artem Glazychev Date: Thu, 18 Jan 2024 18:06:22 +0700 Subject: [PATCH] Add QPS option support Signed-off-by: Artem Glazychev --- internal/config/config.go | 12 +++++++----- main.go | 7 +++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 9ff6bcc..969ac50 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2023 Doc.ai and/or its affiliates. // -// Copyright (c) 2023 Cisco and/or its affiliates. +// Copyright (c) 2023-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -58,10 +58,12 @@ type Config struct { SidecarLimitsCPU string `default:"200m" desc:"Lower bound of the NSM sidecar CPU limit (in k8s resource management units)" split_words:"true"` SidecarRequestsMemory string `default:"40Mi" desc:"Lower bound of the NSM sidecar requests memory limits (in k8s resource management units)" split_words:"true"` SidecarRequestsCPU string `default:"100m" desc:"Lower bound of the NSM sidecar requests CPU limits (in k8s resource management units)" split_words:"true"` - envs []corev1.EnvVar - caBundle []byte - cert tls.Certificate - once sync.Once + // QPS for 50 NSC + KubeletQPS int `default:"50" desc:"kubelet QPS config" split_words:"true"` + envs []corev1.EnvVar + caBundle []byte + cert tls.Certificate + once sync.Once } // Mode internal webhook mode type. diff --git a/main.go b/main.go index 8069a59..6e379ce 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2023 Doc.ai and/or its affiliates. // -// Copyright (c) 2023 Cisco and/or its affiliates. +// Copyright (c) 2023-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -453,7 +453,10 @@ func main() { s := echo.New() s.Use(middleware.Logger()) s.Use(middleware.Recover()) - _, restConfig, err := kubeutils.NewVersionedClient() + restConfig, err := kubeutils.NewClientSetConfig( + kubeutils.WithQPS(float32(conf.KubeletQPS)), + kubeutils.WithBurst(conf.KubeletQPS*2), + ) if err != nil { logger.Fatal(err.Error()) }