Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit a220bd3

Browse files
authored
Expose and increase default sync concurrency (#60)
1 parent 29e1153 commit a220bd3

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

example/config/default/frameworkcontroller.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
#kubeApiServerAddress: http://10.10.10.10:8080
77
#kubeConfigFilePath: ''
88

9-
#workerNumber: 20
9+
# Based on the --max-mutating-requests-inflight is 500.
10+
#kubeClientQps: 200
11+
#kubeClientBurst: 300
12+
#workerNumber: 500
1013

1114
#largeFrameworkCompression: true
1215

example/run/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ metadata:
8181
namespace: default
8282
data:
8383
frameworkcontroller.yaml: |
84-
workerNumber: 20
84+
kubeClientQps: 200
85+
kubeClientBurst: 300
86+
workerNumber: 500
8587
largeFrameworkCompression: true
8688
frameworkCompletedRetainSec: 2592000
8789
#podFailureSpec:

pkg/apis/frameworkcontroller/v1/config.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

pkg/apis/frameworkcontroller/v1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/common/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func PtrInt64(o int64) *int64 {
105105
return &o
106106
}
107107

108+
func PtrFloat32(o float32) *float32 {
109+
return &o
110+
}
111+
108112
func PtrFloat64(o float64) *float64 {
109113
return &o
110114
}

0 commit comments

Comments
 (0)