From f808fbd277fa9d6d9008049cbf5650eba16a14c5 Mon Sep 17 00:00:00 2001 From: ZhiweiYin Date: Wed, 10 Jan 2024 22:53:32 +0800 Subject: [PATCH] add QPS and burst for the agent components Signed-off-by: ZhiweiYin --- ...cluster-management.io_klusterlets.crd.yaml | 18 +++++++++ ...cluster-management.io_klusterlets.crd.yaml | 26 ++++++++++++ operator/v1/types_klusterlet.go | 40 ++++++++++++++++++- .../v1/zz_generated.swagger_doc_generated.go | 12 ++++++ 4 files changed, 95 insertions(+), 1 deletion(-) diff --git a/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml b/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml index 0d94d812f..d2eccfc23 100644 --- a/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml +++ b/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml @@ -115,6 +115,10 @@ spec: description: RegistrationConfiguration contains the configuration of registration type: object properties: + burst: + 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' + type: integer + default: 100 clientCertExpirationSeconds: description: clientCertExpirationSeconds represents the seconds of a client certificate to expire. If it is not set or 0, the default duration seconds will be set by the hub cluster. If the value is larger than the max signing duration seconds set on the hub cluster, the max signing duration seconds will be set. type: integer @@ -142,6 +146,11 @@ spec: enum: - Enable - Disable + qps: + 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' + type: string + default: 50 + pattern: ^(-?\d+)(.\d+)?$ registrationImagePullSpec: description: RegistrationImagePullSpec represents the desired image configuration of registration agent. quay.io/open-cluster-management.io/registration:latest will be used if unspecified. type: string @@ -159,6 +168,10 @@ spec: description: WorkConfiguration contains the configuration of work type: object properties: + burst: + 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' + type: integer + default: 100 featureGates: description: "FeatureGates represents the list of feature gates for work If it is set empty, default feature gates will be used. If it is set, featuregate/Foo is an example of one item in FeatureGates: 1. If featuregate/Foo does not exist, registration-operator will discard it 2. If featuregate/Foo exists and is false by default. It is now possible to set featuregate/Foo=[false|true] 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, \the can set featuregate/Foo=false before upgrading. Let's say the cluster-admin wants featuregate/Foo=false." type: array @@ -177,6 +190,11 @@ spec: enum: - Enable - Disable + qps: + 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' + type: string + default: 50 + pattern: ^(-?\d+)(.\d+)?$ workImagePullSpec: description: WorkImagePullSpec represents the desired image configuration of work agent. quay.io/open-cluster-management.io/work:latest will be used if unspecified. type: string diff --git a/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml b/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml index 11b91da28..55f2b2fa2 100644 --- a/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml +++ b/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml @@ -176,6 +176,12 @@ spec: description: RegistrationConfiguration contains the configuration of registration properties: + burst: + default: 100 + 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' + type: integer clientCertExpirationSeconds: description: clientCertExpirationSeconds represents the seconds of a client certificate to expire. If it is not set or 0, the @@ -223,6 +229,13 @@ spec: - feature type: object type: array + qps: + default: 50 + 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' + pattern: ^(-?\d+)(.\d+)?$ + type: string type: object registrationImagePullSpec: description: RegistrationImagePullSpec represents the desired image @@ -243,6 +256,12 @@ spec: workConfiguration: description: WorkConfiguration contains the configuration of work properties: + burst: + default: 100 + 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' + type: integer featureGates: description: 'FeatureGates represents the list of feature gates for work If it is set empty, default feature gates will be used. @@ -274,6 +293,13 @@ spec: - feature type: object type: array + qps: + default: 50 + 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' + pattern: ^(-?\d+)(.\d+)?$ + type: string type: object workImagePullSpec: description: WorkImagePullSpec represents the desired image configuration diff --git a/operator/v1/types_klusterlet.go b/operator/v1/types_klusterlet.go index 31014edca..6c5906b2c 100644 --- a/operator/v1/types_klusterlet.go +++ b/operator/v1/types_klusterlet.go @@ -80,7 +80,7 @@ type KlusterletSpec struct { // WorkConfiguration contains the configuration of work // +optional - WorkConfiguration *WorkConfiguration `json:"workConfiguration,omitempty"` + WorkConfiguration *WorkAgentConfiguration `json:"workConfiguration,omitempty"` // HubApiServerHostAlias contains the host alias for hub api server. // registration-agent and work-agent will use it to communicate with hub api server. @@ -157,6 +157,44 @@ type RegistrationConfiguration struct { // ManagedCluster when creating only, other actors can update it afterwards. // +optional ClusterAnnotations map[string]string `json:"clusterAnnotations,omitempty"` + + // 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 + // +optional + // +kubebuilder:default:=50 + // +kubebuilder:validation:Pattern=^(-?\d+)(.\d+)?$ + KubeAPIQPS string `json:"qps,omitempty"` + + // 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 + // +optional + // +kubebuilder:default:=100 + KubeAPIBurst int `json:"burst,omitempty"` +} + +type WorkAgentConfiguration struct { + // FeatureGates represents the list of feature gates for work + // If it is set empty, default feature gates will be used. + // If it is set, featuregate/Foo is an example of one item in FeatureGates: + // 1. If featuregate/Foo does not exist, registration-operator will discard it + // 2. If featuregate/Foo exists and is false by default. It is now possible to set featuregate/Foo=[false|true] + // 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, + // he can set featuregate/Foo=false before upgrading. Let's say the cluster-admin wants featuregate/Foo=false. + // +optional + FeatureGates []FeatureGate `json:"featureGates,omitempty"` + + // 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 + // +optional + // +kubebuilder:default:=50 + // +kubebuilder:validation:Pattern=^(-?\d+)(.\d+)?$ + KubeAPIQPS string `json:"qps,omitempty"` + + // 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 + // +optional + // +kubebuilder:default:=100 + KubeAPIBurst int `json:"burst,omitempty"` } const ( diff --git a/operator/v1/zz_generated.swagger_doc_generated.go b/operator/v1/zz_generated.swagger_doc_generated.go index 752ffe2c2..068f5c468 100644 --- a/operator/v1/zz_generated.swagger_doc_generated.go +++ b/operator/v1/zz_generated.swagger_doc_generated.go @@ -236,6 +236,8 @@ var map_RegistrationConfiguration = map[string]string{ "clientCertExpirationSeconds": "clientCertExpirationSeconds represents the seconds of a client certificate to expire. If it is not set or 0, the default duration seconds will be set by the hub cluster. If the value is larger than the max signing duration seconds set on the hub cluster, the max signing duration seconds will be set.", "featureGates": "FeatureGates represents the list of feature gates for registration If it is set empty, default feature gates will be used. If it is set, featuregate/Foo is an example of one item in FeatureGates:\n 1. If featuregate/Foo does not exist, registration-operator will discard it\n 2. If featuregate/Foo exists and is false by default. It is now possible to set featuregate/Foo=[false|true]\n 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,\n \the can set featuregate/Foo=false before upgrading. Let's say the cluster-admin wants featuregate/Foo=false.", "clusterAnnotations": "ClusterAnnotations is annotations with the reserve prefix \"agent.open-cluster-management.io\" set on ManagedCluster when creating only, other actors can update it afterwards.", + "qps": "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", + "burst": "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", } func (RegistrationConfiguration) SwaggerDoc() map[string]string { @@ -260,4 +262,14 @@ func (ServerURL) SwaggerDoc() map[string]string { return map_ServerURL } +var map_WorkAgentConfiguration = map[string]string{ + "featureGates": "FeatureGates represents the list of feature gates for work If it is set empty, default feature gates will be used. If it is set, featuregate/Foo is an example of one item in FeatureGates:\n 1. If featuregate/Foo does not exist, registration-operator will discard it\n 2. If featuregate/Foo exists and is false by default. It is now possible to set featuregate/Foo=[false|true]\n 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,\n \the can set featuregate/Foo=false before upgrading. Let's say the cluster-admin wants featuregate/Foo=false.", + "qps": "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", + "burst": "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", +} + +func (WorkAgentConfiguration) SwaggerDoc() map[string]string { + return map_WorkAgentConfiguration +} + // AUTO-GENERATED FUNCTIONS END HERE