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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user