Add kubernetes QPS and Burst limit configuration (#2899)

Added configurable kubernetes client limits burst and QPS
Default QPS 200 and burst 500. Configurable via helm chart values.

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2024-01-12 22:21:12 +05:30
committed by GitHub
parent 82b2848eb7
commit b801c77432
14 changed files with 102 additions and 3 deletions
+19
View File
@@ -35,6 +35,11 @@ import (
"github.com/fission/fission/pkg/utils"
)
const (
EnvKubeClientQps = "KUBE_CLIENT_QPS"
EnvKubeClientBurst = "KUBE_CLIENT_BURST"
)
type (
ClientGeneratorInterface interface {
GetRestConfig() (*rest.Config, error)
@@ -60,6 +65,20 @@ func (cg *ClientGenerator) getRestConfig() (*rest.Config, error) {
if err != nil {
return nil, err
}
qps, _ := utils.GetUIntValueFromEnv(EnvKubeClientQps)
burst, _ := utils.GetIntValueFromEnv(EnvKubeClientBurst)
// Set QPS and Burst to higher values to avoid throttling
if qps == 0 {
qps = 200
}
if burst == 0 {
burst = 500
}
cg.restConfig.QPS = float32(qps)
cg.restConfig.Burst = burst
return cg.restConfig, nil
}