Skip to content

Commit

Permalink
add QPS and burst for the agent components
Browse files Browse the repository at this point in the history
Signed-off-by: ZhiweiYin <[email protected]>
  • Loading branch information
zhiweiyin318 committed Jan 10, 2024
1 parent f6404f3 commit e83ade8
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
40 changes: 39 additions & 1 deletion operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 (
Expand Down
12 changes: 12 additions & 0 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/integration/api/klusterlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
Name: klusterletName,
},
Spec: operatorv1.KlusterletSpec{
WorkConfiguration: &operatorv1.WorkConfiguration{
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
FeatureGates: []operatorv1.FeatureGate{
{
Feature: "Foo",
Expand All @@ -138,7 +138,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
Name: klusterletName,
},
Spec: operatorv1.KlusterletSpec{
WorkConfiguration: &operatorv1.WorkConfiguration{
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
FeatureGates: []operatorv1.FeatureGate{
{
Feature: "Foo",
Expand All @@ -158,7 +158,7 @@ var _ = Describe("Klusterlet API test with WorkConfiguration", func() {
Name: klusterletName,
},
Spec: operatorv1.KlusterletSpec{
WorkConfiguration: &operatorv1.WorkConfiguration{
WorkConfiguration: &operatorv1.WorkAgentConfiguration{
FeatureGates: []operatorv1.FeatureGate{
{
Feature: "Foo",
Expand Down

0 comments on commit e83ade8

Please sign in to comment.