Skip to content

Commit

Permalink
Increase default rate limit of antrea-controller (#6231)
Browse files Browse the repository at this point in the history
Use higher QPS and Burst rather than the default settings (QPS: 5,
Burst: 10), otherwise synchronizing resources like
ClusterNetworkPolicies and Egresses would be rather slow when they are
created in bulk.

Signed-off-by: Quan Tian <quan.tian@broadcom.com>
  • Loading branch information
tnqn committed Apr 17, 2024
1 parent 7e957dc commit e974fcf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/antrea-controller/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ import (
)

const (
// Use higher QPS and Burst rather than the default settings (QPS: 5, Burst: 10), otherwise synchronizing resources
// like ClusterNetworkPolicies and Egresses would be rather slow when they are created in bulk.
// The following values are recommended by RecommendedDefaultClientConnectionConfiguration.
// https://github.com/kubernetes/kubernetes/blob/b722d017a34b300a2284b890448e5a605f21d01e/staging/src/k8s.io/component-base/config/v1alpha1/defaults.go#L65-L75
defaultClientQPS = 50
defaultClientBurst = 100

ipamIPv4MaskLo = 16
ipamIPv4MaskHi = 30
ipamIPv4MaskDefault = 24
Expand Down Expand Up @@ -194,6 +201,12 @@ func (o *Options) setDefaults() {
if o.config.IPsecCSRSignerConfig.AutoApprove == nil {
o.config.IPsecCSRSignerConfig.AutoApprove = ptrBool(true)
}
if o.config.ClientConnection.QPS == 0.0 {
o.config.ClientConnection.QPS = defaultClientQPS
}
if o.config.ClientConnection.Burst == 0 {
o.config.ClientConnection.Burst = defaultClientBurst
}
}

func ptrBool(value bool) *bool {
Expand Down
2 changes: 2 additions & 0 deletions cmd/antrea-controller/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func TestNewOptions(t *testing.T) {
assert.Equal(t, ipamIPv6MaskDefault, op.config.NodeIPAM.NodeCIDRMaskSizeIPv6)
assert.Equal(t, true, *op.config.IPsecCSRSignerConfig.SelfSignedCA)
assert.Equal(t, true, *op.config.IPsecCSRSignerConfig.AutoApprove)
assert.EqualValues(t, defaultClientQPS, op.config.ClientConnection.QPS)
assert.EqualValues(t, defaultClientBurst, op.config.ClientConnection.Burst)
}

func TestValidateNodeIPAMControllerOptions(t *testing.T) {
Expand Down

0 comments on commit e974fcf

Please sign in to comment.