From 54d9a771b75807628a91a68a6f59bccaaf90163c Mon Sep 17 00:00:00 2001 From: Omar Farag Date: Wed, 26 Mar 2025 17:05:50 -0400 Subject: [PATCH 1/2] add clusterclaimconfig type Signed-off-by: Omar Farag --- ...cluster-management.io_klusterlets.crd.yaml | 16 ++++++++++++ ...cluster-management.io_klusterlets.crd.yaml | 18 +++++++++++++ operator/v1/types_klusterlet.go | 18 +++++++++++++ operator/v1/zz_generated.deepcopy.go | 26 +++++++++++++++++++ .../v1/zz_generated.swagger_doc_generated.go | 11 ++++++++ 5 files changed, 89 insertions(+) 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 066e6bc99..00f7ce074 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 @@ -30,6 +30,22 @@ spec: description: Spec represents the desired deployment configuration of Klusterlet agent. type: object properties: + clusterClaimConfiguration: + description: ClusterClaimConfiguration represents the configuration of ClusterClaim Effective only when the `ClusterClaim` feature gate is enabled. + type: object + required: + - maxCustomClusterClaims + properties: + maxCustomClusterClaims: + description: Maximum number of custom ClusterClaims allowed. + type: integer + format: int32 + default: 20 + reservedClusterClaimSuffixes: + description: Custom suffixes for reserved ClusterClaims. + type: array + items: + type: string clusterName: description: ClusterName is the name of the managed cluster to be created on hub. The Klusterlet agent generates a random name if it is not set, or discovers the appropriate cluster name on OpenShift. 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 442d03160..394d05ce9 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 @@ -43,6 +43,24 @@ spec: description: Spec represents the desired deployment configuration of Klusterlet agent. properties: + clusterClaimConfiguration: + description: |- + ClusterClaimConfiguration represents the configuration of ClusterClaim + Effective only when the `ClusterClaim` feature gate is enabled. + properties: + maxCustomClusterClaims: + default: 20 + description: Maximum number of custom ClusterClaims allowed. + format: int32 + type: integer + reservedClusterClaimSuffixes: + description: Custom suffixes for reserved ClusterClaims. + items: + type: string + type: array + required: + - maxCustomClusterClaims + type: object clusterName: description: |- ClusterName is the name of the managed cluster to be created on hub. diff --git a/operator/v1/types_klusterlet.go b/operator/v1/types_klusterlet.go index dde6ccb14..6b619acab 100644 --- a/operator/v1/types_klusterlet.go +++ b/operator/v1/types_klusterlet.go @@ -99,6 +99,24 @@ type KlusterletSpec struct { // is not available on the managed cluster. // +optional PriorityClassName string `json:"priorityClassName,omitempty"` + + // ClusterClaimConfiguration represents the configuration of ClusterClaim + // Effective only when the `ClusterClaim` feature gate is enabled. + // +optional + ClusterClaimConfiguration *ClusterClaimConfiguration `json:"clusterClaimConfiguration,omitempty"` +} + +// ClusterClaimConfiguration represents the configuration of ClusterClaim +type ClusterClaimConfiguration struct { + // Maximum number of custom ClusterClaims allowed. + // +kubebuilder:validation:Required + // +kubebuilder:default:=20 + // +required + MaxCustomClusterClaims int32 `json:"maxCustomClusterClaims"` + + // Custom suffixes for reserved ClusterClaims. + // +optional + ReservedClusterClaimSuffixes []string `json:"reservedClusterClaimSuffixes,omitempty"` } // ServerURL represents the apiserver url and ca bundle that is accessible externally diff --git a/operator/v1/zz_generated.deepcopy.go b/operator/v1/zz_generated.deepcopy.go index 26348b0e4..8de797c6a 100644 --- a/operator/v1/zz_generated.deepcopy.go +++ b/operator/v1/zz_generated.deepcopy.go @@ -112,6 +112,27 @@ func (in *CSRConfig) DeepCopy() *CSRConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterClaimConfiguration) DeepCopyInto(out *ClusterClaimConfiguration) { + *out = *in + if in.ReservedClusterClaimSuffixes != nil { + in, out := &in.ReservedClusterClaimSuffixes, &out.ReservedClusterClaimSuffixes + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimConfiguration. +func (in *ClusterClaimConfiguration) DeepCopy() *ClusterClaimConfiguration { + if in == nil { + return nil + } + out := new(ClusterClaimConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterManager) DeepCopyInto(out *ClusterManager) { *out = *in @@ -440,6 +461,11 @@ func (in *KlusterletSpec) DeepCopyInto(out *KlusterletSpec) { *out = new(ResourceRequirement) (*in).DeepCopyInto(*out) } + if in.ClusterClaimConfiguration != nil { + in, out := &in.ClusterClaimConfiguration, &out.ClusterClaimConfiguration + *out = new(ClusterClaimConfiguration) + (*in).DeepCopyInto(*out) + } return } diff --git a/operator/v1/zz_generated.swagger_doc_generated.go b/operator/v1/zz_generated.swagger_doc_generated.go index d2308a0b5..2cda108f5 100644 --- a/operator/v1/zz_generated.swagger_doc_generated.go +++ b/operator/v1/zz_generated.swagger_doc_generated.go @@ -210,6 +210,16 @@ func (BootstrapKubeConfigs) SwaggerDoc() map[string]string { return map_BootstrapKubeConfigs } +var map_ClusterClaimConfiguration = map[string]string{ + "": "ClusterClaimConfiguration represents the configuration of ClusterClaim", + "maxCustomClusterClaims": "Maximum number of custom ClusterClaims allowed.", + "reservedClusterClaimSuffixes": "Custom suffixes for reserved ClusterClaims.", +} + +func (ClusterClaimConfiguration) SwaggerDoc() map[string]string { + return map_ClusterClaimConfiguration +} + 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.", @@ -264,6 +274,7 @@ var map_KlusterletSpec = map[string]string{ "hubApiServerHostAlias": "HubApiServerHostAlias contains the host alias for hub api server. registration-agent and work-agent will use it to communicate with hub api server.", "resourceRequirement": "ResourceRequirement specify QoS classes of deployments managed by klusterlet. It applies to all the containers in the deployments.", "priorityClassName": "PriorityClassName is the name of the PriorityClass that will be used by the deployed klusterlet agent. It will be ignored when the PriorityClass/v1 API is not available on the managed cluster.", + "clusterClaimConfiguration": "ClusterClaimConfiguration represents the configuration of ClusterClaim Effective only when the `ClusterClaim` feature gate is enabled.", } func (KlusterletSpec) SwaggerDoc() map[string]string { From 34775f31a2803f4457483aecb663fa5e4be85505 Mon Sep 17 00:00:00 2001 From: Omar Farag Date: Mon, 14 Apr 2025 16:03:51 -0400 Subject: [PATCH 2/2] move ClusterClaimConfiguration to be under RegistrationConfiguration Signed-off-by: Omar Farag --- ...cluster-management.io_klusterlets.crd.yaml | 36 +++++++++---------- operator/v1/types_klusterlet.go | 36 +++++++++---------- operator/v1/zz_generated.deepcopy.go | 10 +++--- .../v1/zz_generated.swagger_doc_generated.go | 2 +- 4 files changed, 42 insertions(+), 42 deletions(-) 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 7d50f68f2..ec7dabab5 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 @@ -43,24 +43,6 @@ spec: description: Spec represents the desired deployment configuration of Klusterlet agent. properties: - clusterClaimConfiguration: - description: |- - ClusterClaimConfiguration represents the configuration of ClusterClaim - Effective only when the `ClusterClaim` feature gate is enabled. - properties: - maxCustomClusterClaims: - default: 20 - description: Maximum number of custom ClusterClaims allowed. - format: int32 - type: integer - reservedClusterClaimSuffixes: - description: Custom suffixes for reserved ClusterClaims. - items: - type: string - type: array - required: - - maxCustomClusterClaims - type: object clusterName: description: |- ClusterName is the name of the managed cluster to be created on hub. @@ -269,6 +251,24 @@ spec: ClusterAnnotations is annotations with the reserve prefix "agent.open-cluster-management.io" set on ManagedCluster when creating only, other actors can update it afterwards. type: object + clusterClaimConfiguration: + description: |- + ClusterClaimConfiguration represents the configuration of ClusterClaim + Effective only when the `ClusterClaim` feature gate is enabled. + properties: + maxCustomClusterClaims: + default: 20 + description: Maximum number of custom ClusterClaims allowed. + format: int32 + type: integer + reservedClusterClaimSuffixes: + description: Custom suffixes for reserved ClusterClaims. + items: + type: string + type: array + required: + - maxCustomClusterClaims + type: object featureGates: description: "FeatureGates represents the list of feature gates for registration\nIf it is set empty, default feature gates diff --git a/operator/v1/types_klusterlet.go b/operator/v1/types_klusterlet.go index acdbd0aaa..706db8901 100644 --- a/operator/v1/types_klusterlet.go +++ b/operator/v1/types_klusterlet.go @@ -99,24 +99,6 @@ type KlusterletSpec struct { // is not available on the managed cluster. // +optional PriorityClassName string `json:"priorityClassName,omitempty"` - - // ClusterClaimConfiguration represents the configuration of ClusterClaim - // Effective only when the `ClusterClaim` feature gate is enabled. - // +optional - ClusterClaimConfiguration *ClusterClaimConfiguration `json:"clusterClaimConfiguration,omitempty"` -} - -// ClusterClaimConfiguration represents the configuration of ClusterClaim -type ClusterClaimConfiguration struct { - // Maximum number of custom ClusterClaims allowed. - // +kubebuilder:validation:Required - // +kubebuilder:default:=20 - // +required - MaxCustomClusterClaims int32 `json:"maxCustomClusterClaims"` - - // Custom suffixes for reserved ClusterClaims. - // +optional - ReservedClusterClaimSuffixes []string `json:"reservedClusterClaimSuffixes,omitempty"` } // ServerURL represents the apiserver url and ca bundle that is accessible externally @@ -194,6 +176,24 @@ type RegistrationConfiguration struct { // This provides driver details required to register with hub // +optional RegistrationDriver RegistrationDriver `json:"registrationDriver,omitempty"` + + // ClusterClaimConfiguration represents the configuration of ClusterClaim + // Effective only when the `ClusterClaim` feature gate is enabled. + // +optional + ClusterClaimConfiguration *ClusterClaimConfiguration `json:"clusterClaimConfiguration,omitempty"` +} + +// ClusterClaimConfiguration represents the configuration of ClusterClaim +type ClusterClaimConfiguration struct { + // Maximum number of custom ClusterClaims allowed. + // +kubebuilder:validation:Required + // +kubebuilder:default:=20 + // +required + MaxCustomClusterClaims int32 `json:"maxCustomClusterClaims"` + + // Custom suffixes for reserved ClusterClaims. + // +optional + ReservedClusterClaimSuffixes []string `json:"reservedClusterClaimSuffixes,omitempty"` } type RegistrationDriver struct { diff --git a/operator/v1/zz_generated.deepcopy.go b/operator/v1/zz_generated.deepcopy.go index 98d544a03..240612641 100644 --- a/operator/v1/zz_generated.deepcopy.go +++ b/operator/v1/zz_generated.deepcopy.go @@ -465,11 +465,6 @@ func (in *KlusterletSpec) DeepCopyInto(out *KlusterletSpec) { *out = new(ResourceRequirement) (*in).DeepCopyInto(*out) } - if in.ClusterClaimConfiguration != nil { - in, out := &in.ClusterClaimConfiguration, &out.ClusterClaimConfiguration - *out = new(ClusterClaimConfiguration) - (*in).DeepCopyInto(*out) - } return } @@ -600,6 +595,11 @@ func (in *RegistrationConfiguration) DeepCopyInto(out *RegistrationConfiguration } in.BootstrapKubeConfigs.DeepCopyInto(&out.BootstrapKubeConfigs) in.RegistrationDriver.DeepCopyInto(&out.RegistrationDriver) + if in.ClusterClaimConfiguration != nil { + in, out := &in.ClusterClaimConfiguration, &out.ClusterClaimConfiguration + *out = new(ClusterClaimConfiguration) + (*in).DeepCopyInto(*out) + } return } diff --git a/operator/v1/zz_generated.swagger_doc_generated.go b/operator/v1/zz_generated.swagger_doc_generated.go index 2cda108f5..1c56a8551 100644 --- a/operator/v1/zz_generated.swagger_doc_generated.go +++ b/operator/v1/zz_generated.swagger_doc_generated.go @@ -274,7 +274,6 @@ var map_KlusterletSpec = map[string]string{ "hubApiServerHostAlias": "HubApiServerHostAlias contains the host alias for hub api server. registration-agent and work-agent will use it to communicate with hub api server.", "resourceRequirement": "ResourceRequirement specify QoS classes of deployments managed by klusterlet. It applies to all the containers in the deployments.", "priorityClassName": "PriorityClassName is the name of the PriorityClass that will be used by the deployed klusterlet agent. It will be ignored when the PriorityClass/v1 API is not available on the managed cluster.", - "clusterClaimConfiguration": "ClusterClaimConfiguration represents the configuration of ClusterClaim Effective only when the `ClusterClaim` feature gate is enabled.", } func (KlusterletSpec) SwaggerDoc() map[string]string { @@ -318,6 +317,7 @@ var map_RegistrationConfiguration = map[string]string{ "kubeAPIBurst": "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", "bootstrapKubeConfigs": "BootstrapKubeConfigs defines the ordered list of bootstrap kubeconfigs. The order decides which bootstrap kubeconfig to use first when rebootstrap.\n\nWhen the agent loses the connection to the current hub over HubConnectionTimeoutSeconds, or the managedcluster CR is set `hubAcceptsClient=false` on the hub, the controller marks the related bootstrap kubeconfig as \"failed\".\n\nA failed bootstrapkubeconfig won't be used for the duration specified by SkipFailedBootstrapKubeConfigSeconds. But if the user updates the content of a failed bootstrapkubeconfig, the \"failed\" mark will be cleared.", "registrationDriver": "This provides driver details required to register with hub", + "clusterClaimConfiguration": "ClusterClaimConfiguration represents the configuration of ClusterClaim Effective only when the `ClusterClaim` feature gate is enabled.", } func (RegistrationConfiguration) SwaggerDoc() map[string]string {