diff --git a/apiserver/cmd/server/server.go b/apiserver/cmd/server/server.go index aeb59a08..83da1198 100644 --- a/apiserver/cmd/server/server.go +++ b/apiserver/cmd/server/server.go @@ -95,6 +95,12 @@ func main() { if cfg.Kubernetes.TokenPath == "" { cfg.Kubernetes.TokenPath = "/run/secrets/kubernetes.io/serviceaccount/token" } + if cfg.Kubernetes.QPS <= 0 { + cfg.Kubernetes.QPS = 50 + } + if cfg.Kubernetes.Burst <= 0 { + cfg.Kubernetes.Burst = 100 + } if cfg.DefaultLimits.MemMax <= 0 { cfg.DefaultLimits.MemMax = 8196 //M } @@ -144,6 +150,9 @@ func main() { } } + kConfig.QPS = cfg.Kubernetes.QPS + kConfig.Burst = cfg.Kubernetes.Burst + kube, err := kube.NewKubeHelper(cfg.Kubernetes.Address, cfg.Kubernetes.Username, cfg.Kubernetes.Password, cfg.Kubernetes.TokenPath, kConfig, cfg.AuthSignInURL, cfg.AuthURL) if err != nil { diff --git a/apiserver/pkg/config/config.go b/apiserver/pkg/config/config.go index 8563f3cf..72a0dce9 100644 --- a/apiserver/pkg/config/config.go +++ b/apiserver/pkg/config/config.go @@ -33,9 +33,9 @@ type Specs struct { Path string `json:"path"` } type Volume struct { - Path string `json:"path"` - Name string `json:"name"` - ReadOnly bool `json:"readOnly"` + Path string `json:"path"` + Name string `json:"name"` + ReadOnly bool `json:"readOnly"` } type DefaultLimits struct { @@ -51,13 +51,15 @@ type Etcd struct { MaxMessages int `json:"maxMessages"` } type Kubernetes struct { - Address string `json:"address"` - TokenPath string `json:"tokenPath"` - Username string `json:"username"` - Password string `json:"password"` - NodeSelectorName string `json:"nodeSelectorName"` - NodeSelectorValue string `json:"nodeSelectorValue"` - StorageClass string `json:"pvcStorageClass"` + Address string `json:"address"` + TokenPath string `json:"tokenPath"` + Username string `json:"username"` + Password string `json:"password"` + NodeSelectorName string `json:"nodeSelectorName"` + NodeSelectorValue string `json:"nodeSelectorValue"` + StorageClass string `json:"pvcStorageClass"` + QPS float32 `json:"qps"` + Burst int `json:"burst"` } type Email struct { Host string `json:"host"`