Skip to content

Commit

Permalink
add flag option field for the operator CRDs
Browse files Browse the repository at this point in the history
Signed-off-by: ZhiweiYin <[email protected]>
  • Loading branch information
zhiweiyin318 committed Jan 9, 2024
1 parent f6404f3 commit a1fa1b4
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
47 changes: 20 additions & 27 deletions operator/v1/types_clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
12 changes: 2 additions & 10 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit a1fa1b4

Please sign in to comment.