From a1fa1b4c4e09a0ba9f22fbcab49e9a33626381c4 Mon Sep 17 00:00:00 2001 From: ZhiweiYin Date: Tue, 9 Jan 2024 23:24:40 +0800 Subject: [PATCH] add flag option field for the operator CRDs Signed-off-by: ZhiweiYin --- ...cluster-management.io_klusterlets.crd.yaml | 14 +++++- ...cluster-management.io_klusterlets.crd.yaml | 34 ++++++++++---- ...ter-management.io_clustermanagers.crd.yaml | 45 ++++++++++++++---- operator/v1/types_clustermanager.go | 47 ++++++++----------- operator/v1/types_klusterlet.go | 12 +---- .../v1/zz_generated.swagger_doc_generated.go | 27 ++++------- 6 files changed, 105 insertions(+), 74 deletions(-) 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..bf169fc3a 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 @@ -125,7 +125,7 @@ spec: additionalProperties: type: string featureGates: - description: "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: 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." + description: "FeatureGates represents the list of feature gates for the component. 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 items: type: object @@ -142,6 +142,11 @@ spec: enum: - Enable - Disable + flagOptions: + description: FlagOptions represents a list of flag options for the binary of each component. The key is the option name, the value is the option value. The FlagOptions can override all configured options including the default options and FeatureGates, etc. + type: object + additionalProperties: + type: string 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 @@ -160,7 +165,7 @@ spec: type: object properties: 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." + description: "FeatureGates represents the list of feature gates for the component. 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 items: type: object @@ -177,6 +182,11 @@ spec: enum: - Enable - Disable + flagOptions: + description: FlagOptions represents a list of flag options for the binary of each component. The key is the option name, the value is the option value. The FlagOptions can override all configured options including the default options and FeatureGates, etc. + type: object + additionalProperties: + type: string 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..40044353e 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 @@ -194,9 +194,9 @@ spec: type: object featureGates: description: '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: 1. If featuregate/Foo does not exist, + for the component. 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 @@ -223,6 +223,15 @@ spec: - feature type: object type: array + flagOptions: + additionalProperties: + type: string + description: FlagOptions represents a list of flag options for + the binary of each component. The key is the option name, the + value is the option value. The FlagOptions can override all + configured options including the default options and FeatureGates, + etc. + type: object type: object registrationImagePullSpec: description: RegistrationImagePullSpec represents the desired image @@ -245,11 +254,11 @@ spec: properties: 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] + for the component. 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 @@ -274,6 +283,15 @@ spec: - feature type: object type: array + flagOptions: + additionalProperties: + type: string + description: FlagOptions represents a list of flag options for + the binary of each component. The key is the option name, the + value is the option value. The FlagOptions can override all + configured options including the default options and FeatureGates, + etc. + type: object type: object workImagePullSpec: description: WorkImagePullSpec represents the desired image configuration diff --git a/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml b/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml index b57e95f5f..d425484c0 100644 --- a/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml +++ b/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml @@ -46,7 +46,7 @@ spec: properties: featureGates: description: 'FeatureGates represents the list of feature gates - for addon manager If it is set empty, default feature gates + for the component. 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 @@ -75,6 +75,15 @@ spec: - feature type: object type: array + flagOptions: + additionalProperties: + type: string + description: FlagOptions represents a list of flag options for + the binary of each component. The key is the option name, the + value is the option value. The FlagOptions can override all + configured options including the default options and FeatureGates, + etc. + type: object type: object addOnManagerImagePullSpec: default: quay.io/open-cluster-management/addon-manager @@ -224,9 +233,9 @@ spec: type: array featureGates: description: '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: 1. If featuregate/Foo does not exist, + for the component. 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 @@ -253,6 +262,15 @@ spec: - feature type: object type: array + flagOptions: + additionalProperties: + type: string + description: FlagOptions represents a list of flag options for + the binary of each component. The key is the option name, the + value is the option value. The FlagOptions can override all + configured options including the default options and FeatureGates, + etc. + type: object type: object registrationImagePullSpec: default: quay.io/open-cluster-management/registration @@ -264,11 +282,11 @@ spec: properties: 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] + for the component. 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 @@ -293,6 +311,15 @@ spec: - feature type: object type: array + flagOptions: + additionalProperties: + type: string + description: FlagOptions represents a list of flag options for + the binary of each component. The key is the option name, the + value is the option value. The FlagOptions can override all + configured options including the default options and FeatureGates, + etc. + type: object type: object workImagePullSpec: default: quay.io/open-cluster-management/work diff --git a/operator/v1/types_clustermanager.go b/operator/v1/types_clustermanager.go index e833fa7bf..4fc34389c 100644 --- a/operator/v1/types_clustermanager.go +++ b/operator/v1/types_clustermanager.go @@ -93,39 +93,15 @@ type RegistrationHubConfiguration struct { // +optional AutoApproveUsers []string `json:"autoApproveUsers,omitempty"` - // 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: - // 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"` + ComponentConfiguration `json:",inline"` } type WorkConfiguration 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"` + ComponentConfiguration `json:",inline"` } type AddOnManagerConfiguration struct { - // FeatureGates represents the list of feature gates for addon manager - // 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"` + ComponentConfiguration `json:",inline"` } type FeatureGate struct { @@ -152,6 +128,23 @@ const ( FeatureGateModeTypeDisable FeatureGateModeType = "Disable" ) +type ComponentConfiguration struct { + // FeatureGates represents the list of feature gates for the component. + // 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"` + + // FlagOptions represents a list of flag options for the binary of each component. + // The key is the option name, the value is the option value. + // The FlagOptions can override all configured options including the default options and FeatureGates, etc. + FlagOptions map[string]string `json:"flagOptions,omitempty"` +} + // HostedClusterManagerConfiguration represents customized configurations we need to set for clustermanager in the Hosted mode. type HostedClusterManagerConfiguration struct { // RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration. diff --git a/operator/v1/types_klusterlet.go b/operator/v1/types_klusterlet.go index 31014edca..c74972754 100644 --- a/operator/v1/types_klusterlet.go +++ b/operator/v1/types_klusterlet.go @@ -137,22 +137,14 @@ type HubApiServerHostAlias struct { } type RegistrationConfiguration struct { + ComponentConfiguration `json:",inline"` + // 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. // +optional ClientCertExpirationSeconds int32 `json:"clientCertExpirationSeconds,omitempty"` - // 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: - // 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"` - // ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on // ManagedCluster when creating only, other actors can update it afterwards. // +optional diff --git a/operator/v1/zz_generated.swagger_doc_generated.go b/operator/v1/zz_generated.swagger_doc_generated.go index 752ffe2c2..b1ae757f4 100644 --- a/operator/v1/zz_generated.swagger_doc_generated.go +++ b/operator/v1/zz_generated.swagger_doc_generated.go @@ -11,14 +11,6 @@ package v1 // Those methods can be generated by using hack/update-swagger-docs.sh // AUTO-GENERATED FUNCTIONS START HERE -var map_AddOnManagerConfiguration = map[string]string{ - "featureGates": "FeatureGates represents the list of feature gates for addon manager 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.", -} - -func (AddOnManagerConfiguration) SwaggerDoc() map[string]string { - return map_AddOnManagerConfiguration -} - var map_ClusterManager = map[string]string{ "": "ClusterManager configures the controllers on the hub that govern registration and work distribution for attached Klusterlets. In Default mode, ClusterManager will only be deployed in open-cluster-management-hub namespace. In Hosted mode, ClusterManager will be deployed in the namespace with the same name as cluster manager.", "spec": "Spec represents a desired deployment configuration of controllers that govern registration and work distribution for attached Klusterlets.", @@ -78,6 +70,15 @@ func (ClusterManagerStatus) SwaggerDoc() map[string]string { return map_ClusterManagerStatus } +var map_ComponentConfiguration = map[string]string{ + "featureGates": "FeatureGates represents the list of feature gates for the component. 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.", + "flagOptions": "FlagOptions represents a list of flag options for the binary of each component. The key is the option name, the value is the option value. The FlagOptions can override all configured options including the default options and FeatureGates, etc.", +} + +func (ComponentConfiguration) SwaggerDoc() map[string]string { + return map_ComponentConfiguration +} + var map_FeatureGate = map[string]string{ "feature": "Feature is the key of feature gate. e.g. featuregate/Foo.", "mode": "Mode is either Enable, Disable, \"\" where \"\" is Disable by default. In Enable mode, a valid feature gate `featuregate/Foo` will be set to \"--featuregate/Foo=true\". In Disable mode, a valid feature gate `featuregate/Foo` will be set to \"--featuregate/Foo=false\".", @@ -123,7 +124,6 @@ func (NodePlacement) SwaggerDoc() map[string]string { var map_RegistrationHubConfiguration = map[string]string{ "autoApproveUsers": "AutoApproveUser represents a list of users that can auto approve CSR and accept client. If the credential of the bootstrap-hub-kubeconfig matches to the users, the cluster created by the bootstrap-hub-kubeconfig will be auto-registered into the hub cluster. This takes effect only when ManagedClusterAutoApproval feature gate is enabled.", - "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.", } func (RegistrationHubConfiguration) SwaggerDoc() map[string]string { @@ -153,14 +153,6 @@ func (WebhookConfiguration) SwaggerDoc() map[string]string { return map_WebhookConfiguration } -var map_WorkConfiguration = 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.", -} - -func (WorkConfiguration) SwaggerDoc() map[string]string { - return map_WorkConfiguration -} - var map_HubApiServerHostAlias = map[string]string{ "": "HubApiServerHostAlias holds the mapping between IP and hostname that will be injected as an entry in the pod's hosts file.", "ip": "IP address of the host file entry.", @@ -234,7 +226,6 @@ func (KlusterletStatus) SwaggerDoc() map[string]string { 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.", }