Skip to content

Commit 3d94ce8

Browse files
authored
add QPS and burst for the agent components (#311)
Signed-off-by: ZhiweiYin <[email protected]>
1 parent d6f9e4c commit 3d94ce8

6 files changed

+122
-6
lines changed

crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ spec:
142142
enum:
143143
- Enable
144144
- Disable
145+
kubeAPIBurst:
146+
description: 'KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 100'
147+
type: integer
148+
format: int32
149+
default: 100
150+
kubeAPIQPS:
151+
description: 'KubeAPIQPS indicates the maximum QPS while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 50'
152+
type: integer
153+
format: int32
154+
default: 50
145155
registrationImagePullSpec:
146156
description: RegistrationImagePullSpec represents the desired image configuration of registration agent. quay.io/open-cluster-management.io/registration:latest will be used if unspecified.
147157
type: string
@@ -177,6 +187,16 @@ spec:
177187
enum:
178188
- Enable
179189
- Disable
190+
kubeAPIBurst:
191+
description: 'KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 100'
192+
type: integer
193+
format: int32
194+
default: 100
195+
kubeAPIQPS:
196+
description: 'KubeAPIQPS indicates the maximum QPS while talking with apiserver of hub cluster from the spoke cluster. If it is set empty, use the default value: 50'
197+
type: integer
198+
format: int32
199+
default: 50
180200
workImagePullSpec:
181201
description: WorkImagePullSpec represents the desired image configuration of work agent. quay.io/open-cluster-management.io/work:latest will be used if unspecified.
182202
type: string

operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,20 @@ spec:
223223
- feature
224224
type: object
225225
type: array
226+
kubeAPIBurst:
227+
default: 100
228+
description: 'KubeAPIBurst indicates the maximum burst of the
229+
throttle while talking with apiserver of hub cluster from the
230+
spoke cluster. If it is set empty, use the default value: 100'
231+
format: int32
232+
type: integer
233+
kubeAPIQPS:
234+
default: 50
235+
description: 'KubeAPIQPS indicates the maximum QPS while talking
236+
with apiserver of hub cluster from the spoke cluster. If it
237+
is set empty, use the default value: 50'
238+
format: int32
239+
type: integer
226240
type: object
227241
registrationImagePullSpec:
228242
description: RegistrationImagePullSpec represents the desired image
@@ -274,6 +288,20 @@ spec:
274288
- feature
275289
type: object
276290
type: array
291+
kubeAPIBurst:
292+
default: 100
293+
description: 'KubeAPIBurst indicates the maximum burst of the
294+
throttle while talking with apiserver of hub cluster from the
295+
spoke cluster. If it is set empty, use the default value: 100'
296+
format: int32
297+
type: integer
298+
kubeAPIQPS:
299+
default: 50
300+
description: 'KubeAPIQPS indicates the maximum QPS while talking
301+
with apiserver of hub cluster from the spoke cluster. If it
302+
is set empty, use the default value: 50'
303+
format: int32
304+
type: integer
277305
type: object
278306
workImagePullSpec:
279307
description: WorkImagePullSpec represents the desired image configuration

operator/v1/types_klusterlet.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type KlusterletSpec struct {
8080

8181
// WorkConfiguration contains the configuration of work
8282
// +optional
83-
WorkConfiguration *WorkConfiguration `json:"workConfiguration,omitempty"`
83+
WorkConfiguration *WorkAgentConfiguration `json:"workConfiguration,omitempty"`
8484

8585
// HubApiServerHostAlias contains the host alias for hub api server.
8686
// registration-agent and work-agent will use it to communicate with hub api server.
@@ -157,6 +157,42 @@ type RegistrationConfiguration struct {
157157
// ManagedCluster when creating only, other actors can update it afterwards.
158158
// +optional
159159
ClusterAnnotations map[string]string `json:"clusterAnnotations,omitempty"`
160+
161+
// KubeAPIQPS indicates the maximum QPS while talking with apiserver of hub cluster from the spoke cluster.
162+
// If it is set empty, use the default value: 50
163+
// +optional
164+
// +kubebuilder:default:=50
165+
KubeAPIQPS int32 `json:"kubeAPIQPS,omitempty"`
166+
167+
// KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster.
168+
// If it is set empty, use the default value: 100
169+
// +optional
170+
// +kubebuilder:default:=100
171+
KubeAPIBurst int32 `json:"kubeAPIBurst,omitempty"`
172+
}
173+
174+
type WorkAgentConfiguration struct {
175+
// FeatureGates represents the list of feature gates for work
176+
// If it is set empty, default feature gates will be used.
177+
// If it is set, featuregate/Foo is an example of one item in FeatureGates:
178+
// 1. If featuregate/Foo does not exist, registration-operator will discard it
179+
// 2. If featuregate/Foo exists and is false by default. It is now possible to set featuregate/Foo=[false|true]
180+
// 3. If featuregate/Foo exists and is true by default. If a cluster-admin upgrading from 1 to 2 wants to continue having featuregate/Foo=false,
181+
// he can set featuregate/Foo=false before upgrading. Let's say the cluster-admin wants featuregate/Foo=false.
182+
// +optional
183+
FeatureGates []FeatureGate `json:"featureGates,omitempty"`
184+
185+
// KubeAPIQPS indicates the maximum QPS while talking with apiserver of hub cluster from the spoke cluster.
186+
// If it is set empty, use the default value: 50
187+
// +optional
188+
// +kubebuilder:default:=50
189+
KubeAPIQPS int32 `json:"kubeAPIQPS,omitempty"`
190+
191+
// KubeAPIBurst indicates the maximum burst of the throttle while talking with apiserver of hub cluster from the spoke cluster.
192+
// If it is set empty, use the default value: 100
193+
// +optional
194+
// +kubebuilder:default:=100
195+
KubeAPIBurst int32 `json:"kubeAPIBurst,omitempty"`
160196
}
161197

162198
const (

operator/v1/zz_generated.deepcopy.go

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/v1/zz_generated.swagger_doc_generated.go

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

test/integration/api/klusterlet_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package api
33
import (
44
"context"
55
"fmt"
6-
76
. "github.com/onsi/ginkgo"
87
. "github.com/onsi/gomega"
98
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -118,7 +117,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
118117
Name: klusterletName,
119118
},
120119
Spec: operatorv1.KlusterletSpec{
121-
WorkConfiguration: &operatorv1.WorkConfiguration{
120+
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
122121
FeatureGates: []operatorv1.FeatureGate{
123122
{
124123
Feature: "Foo",
@@ -138,7 +137,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
138137
Name: klusterletName,
139138
},
140139
Spec: operatorv1.KlusterletSpec{
141-
WorkConfiguration: &operatorv1.WorkConfiguration{
140+
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
142141
FeatureGates: []operatorv1.FeatureGate{
143142
{
144143
Feature: "Foo",
@@ -158,7 +157,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
158157
Name: klusterletName,
159158
},
160159
Spec: operatorv1.KlusterletSpec{
161-
WorkConfiguration: &operatorv1.WorkConfiguration{
160+
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
162161
FeatureGates: []operatorv1.FeatureGate{
163162
{
164163
Feature: "Foo",

0 commit comments

Comments
 (0)