@@ -56,7 +56,14 @@ type Config struct {
5656 KubeApiServerAddress * string `yaml:"kubeApiServerAddress"`
5757 KubeConfigFilePath * string `yaml:"kubeConfigFilePath"`
5858
59- // Number of concurrent workers to process each different Frameworks
59+ // Rate limits of requests from FrameworkController to ApiServer.
60+ // Generally, it should be proportional to the cluster Framework workload, and within the ApiServer
61+ // serving capacity/limit such as the --max-mutating-requests-inflight.
62+ KubeClientQps * float32 `yaml:"kubeClientQps"`
63+ KubeClientBurst * int32 `yaml:"kubeClientBurst"`
64+
65+ // Number of concurrent workers to process each different Frameworks.
66+ // Generally, it should be proportional to the above rate limits of requests.
6067 WorkerNumber * int32 `yaml:"workerNumber"`
6168
6269 // Specify whether to compress some fields in the Framework object if they are too large.
@@ -215,8 +222,15 @@ func NewConfig() *Config {
215222 if c .KubeConfigFilePath == nil {
216223 c .KubeConfigFilePath = defaultKubeConfigFilePath ()
217224 }
225+ // Based on the default --max-mutating-requests-inflight is 200.
226+ if c .KubeClientQps == nil {
227+ c .KubeClientQps = common .PtrFloat32 (80 )
228+ }
229+ if c .KubeClientBurst == nil {
230+ c .KubeClientBurst = common .PtrInt32 (120 )
231+ }
218232 if c .WorkerNumber == nil {
219- c .WorkerNumber = common .PtrInt32 (10 )
233+ c .WorkerNumber = common .PtrInt32 (200 )
220234 }
221235 if c .LargeFrameworkCompression == nil {
222236 c .LargeFrameworkCompression = common .PtrBool (false )
@@ -263,6 +277,16 @@ func NewConfig() *Config {
263277
264278 // Validation
265279 errPrefix := "Config Validation Failed: "
280+ if * c .KubeClientQps <= 0 || * c .KubeClientQps > 10000 {
281+ panic (fmt .Errorf (errPrefix +
282+ "KubeClientQps %v should be within (0, 10000]" ,
283+ * c .KubeClientQps ))
284+ }
285+ if * c .KubeClientBurst < 0 || * c .KubeClientBurst > 10000 {
286+ panic (fmt .Errorf (errPrefix +
287+ "KubeClientBurst %v should be within [0, 10000]" ,
288+ * c .KubeClientBurst ))
289+ }
266290 if * c .WorkerNumber <= 0 {
267291 panic (fmt .Errorf (errPrefix +
268292 "WorkerNumber %v should be positive" ,
@@ -387,5 +411,8 @@ func BuildKubeConfig(cConfig *Config) *rest.Config {
387411 "${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} is valid: " +
388412 "Error: %v" , err ))
389413 }
414+
415+ kConfig .QPS = * cConfig .KubeClientQps
416+ kConfig .Burst = int (* cConfig .KubeClientBurst )
390417 return kConfig
391418}
0 commit comments