Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add QPS and burst for the agent components #311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ spec:
enum:
- Enable
- Disable
kubeAPIBurst:
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
format: int32
default: 100
kubeAPIQPS:
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: integer
format: int32
default: 50
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 Down Expand Up @@ -177,6 +187,16 @@ spec:
enum:
- Enable
- Disable
kubeAPIBurst:
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
format: int32
default: 100
kubeAPIQPS:
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: integer
format: int32
default: 50
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 @@ -223,6 +223,20 @@ spec:
- feature
type: object
type: array
kubeAPIBurst:
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'
format: int32
type: integer
kubeAPIQPS:
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'
format: int32
type: integer
type: object
registrationImagePullSpec:
description: RegistrationImagePullSpec represents the desired image
Expand Down Expand Up @@ -274,6 +288,20 @@ spec:
- feature
type: object
type: array
kubeAPIBurst:
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'
format: int32
type: integer
kubeAPIQPS:
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'
format: int32
type: integer
type: object
workImagePullSpec:
description: WorkImagePullSpec represents the desired image configuration
Expand Down
38 changes: 37 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,42 @@ 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
KubeAPIQPS int32 `json:"kubeAPIQPS,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 int32 `json:"kubeAPIBurst,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
KubeAPIQPS int32 `json:"kubeAPIQPS,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 int32 `json:"kubeAPIBurst,omitempty"`
}

const (
Expand Down
23 changes: 22 additions & 1 deletion operator/v1/zz_generated.deepcopy.go

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

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.

7 changes: 3 additions & 4 deletions test/integration/api/klusterlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package api
import (
"context"
"fmt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -118,7 +117,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 +137,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 +157,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
Loading