From bc72cf230694cf75eecadc91ccc0ec2d8ac9101d Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Tue, 2 Nov 2021 13:56:45 +0800 Subject: [PATCH] Add listmap for list structs Signed-off-by: Jian Qiu --- ...pen-cluster-management.io_managedclusteraddons.crd.yaml | 3 +++ addon/v1alpha1/types_managedclusteraddon.go | 6 +++--- ...ers.open-cluster-management.io_managedclusters.crd.yaml | 6 ++++++ cluster/v1/types.go | 4 ++++ ...clusters.open-cluster-management.io_placements.crd.yaml | 7 +++++++ ....open-cluster-management.io_placementdecisions.crd.yaml | 3 +++ cluster/v1alpha1/types.go | 7 +++++++ cluster/v1alpha1/zz_generated.swagger_doc_generated.go | 5 +++-- ....open-cluster-management.io_managedclustersets.crd.yaml | 3 +++ cluster/v1beta1/types.go | 3 +++ ...perator.open-cluster-management.io_klusterlets.crd.yaml | 3 +++ ...tor.open-cluster-management.io_clustermanagers.crd.yaml | 3 +++ ...perator.open-cluster-management.io_klusterlets.crd.yaml | 3 +++ operator/v1/types.go | 4 ++++ ..._work.open-cluster-management.io_manifestworks.crd.yaml | 6 ++++++ work/v1/types.go | 4 ++++ 16 files changed, 65 insertions(+), 5 deletions(-) diff --git a/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml b/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml index 88eea4d56..2f51af7f9 100644 --- a/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml +++ b/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml @@ -164,6 +164,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map registrations: description: registrations is the conifigurations for the addon agent to register to hub. It should be set by each addon controller on diff --git a/addon/v1alpha1/types_managedclusteraddon.go b/addon/v1alpha1/types_managedclusteraddon.go index 865bc17a8..951bf18b1 100644 --- a/addon/v1alpha1/types_managedclusteraddon.go +++ b/addon/v1alpha1/types_managedclusteraddon.go @@ -78,10 +78,10 @@ type Subject struct { // +k8s:deepcopy-gen=true type ManagedClusterAddOnStatus struct { // conditions describe the state of the managed and monitored components for the operator. - // +patchMergeKey=type - // +patchStrategy=merge + // +listMapKey:=type + // +listType:=map // +optional - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` + Conditions []metav1.Condition `json:"conditions,omitempty"` // relatedObjects is a list of objects that are "interesting" or related to this operator. Common uses are: // 1. the detailed resource driving the operator diff --git a/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml b/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml index cb876560a..d73df12e6 100644 --- a/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml +++ b/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml @@ -153,6 +153,9 @@ spec: type: string maxLength: 1024 minLength: 1 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map conditions: description: Conditions contains the different condition statuses for this managed cluster. @@ -224,6 +227,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map version: description: Version represents the kubernetes version of the managed cluster. diff --git a/cluster/v1/types.go b/cluster/v1/types.go index 8ebced45b..34efa09e6 100644 --- a/cluster/v1/types.go +++ b/cluster/v1/types.go @@ -84,6 +84,8 @@ type ClientConfig struct { // ManagedClusterStatus represents the current status of joined managed cluster. type ManagedClusterStatus struct { // Conditions contains the different condition statuses for this managed cluster. + // +listMapKey:=type + // +listType:=map Conditions []metav1.Condition `json:"conditions"` // Capacity represents the total resource capacity from all nodeStatuses @@ -101,6 +103,8 @@ type ManagedClusterStatus struct { // (kubeversion.open-cluster-management.io). They are written from the managed // cluster. The set of claims is not uniform across a fleet, some claims can be // vendor or version specific and may not be included from all managed clusters. + // +listMapKey:=name + // +listType:=map // +optional ClusterClaims []ManagedClusterClaim `json:"clusterClaims,omitempty"` } diff --git a/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml b/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml index abeb63876..da2b4c972 100644 --- a/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml +++ b/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml @@ -200,6 +200,7 @@ spec: type: object properties: configurations: + description: Configurations deinfes a list of prioritizer configurations type: array items: description: PrioritizerConfig represents the configuration @@ -228,6 +229,9 @@ spec: default: 1 maximum: 10 minimum: 0 + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map mode: description: Mode is either Exact, Additive, "" where "" is Additive by default. In Additive mode, any prioritizer not explicitly @@ -316,6 +320,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map numberOfSelectedClusters: description: NumberOfSelectedClusters represents the number of selected ManagedClusters diff --git a/cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml b/cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml index fc75289ea..347a9597a 100644 --- a/cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml +++ b/cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml @@ -64,6 +64,9 @@ spec: description: Reason represents the reason why the ManagedCluster is selected. type: string + x-kubernetes-list-map-keys: + - clusterName + x-kubernetes-list-type: map served: true storage: true subresources: diff --git a/cluster/v1alpha1/types.go b/cluster/v1alpha1/types.go index 06a5cc5c6..b7cb94ec7 100644 --- a/cluster/v1alpha1/types.go +++ b/cluster/v1alpha1/types.go @@ -286,7 +286,10 @@ type PrioritizerPolicy struct { // +optional Mode PrioritizerPolicyModeType `json:"mode,omitempty"` + // Configurations deinfes a list of prioritizer configurations // +optional + // +listMapKey:=name + // +listType:=map Configurations []PrioritizerConfig `json:"configurations,omitempty"` } @@ -327,6 +330,8 @@ type PlacementStatus struct { NumberOfSelectedClusters int32 `json:"numberOfSelectedClusters"` // Conditions contains the different condition statuses for this Placement. + // +listMapKey:=type + // +listType:=map // +optional Conditions []metav1.Condition `json:"conditions"` } @@ -386,6 +391,8 @@ type PlacementDecisionStatus struct { // Decisions is a slice of decisions according to a placement // The number of decisions should not be larger than 100 // +kubebuilder:validation:Required + // +listMapKey:=clusterName + // +listType:=map // +required Decisions []ClusterDecision `json:"decisions"` } diff --git a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index f5b21e079..d185fc1d0 100644 --- a/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -221,8 +221,9 @@ func (PrioritizerConfig) SwaggerDoc() map[string]string { } var map_PrioritizerPolicy = map[string]string{ - "": "PrioritizerPolicy represents the policy of prioritizer", - "mode": "Mode is either Exact, Additive, \"\" where \"\" is Additive by default. In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, and additional prioritization will happen. In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases.", + "": "PrioritizerPolicy represents the policy of prioritizer", + "mode": "Mode is either Exact, Additive, \"\" where \"\" is Additive by default. In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, and additional prioritization will happen. In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases.", + "configurations": "Configurations deinfes a list of prioritizer configurations", } func (PrioritizerPolicy) SwaggerDoc() map[string]string { diff --git a/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml b/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml index 4d0e12b3c..a2b382a30 100644 --- a/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml +++ b/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml @@ -243,6 +243,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map served: true storage: true subresources: diff --git a/cluster/v1beta1/types.go b/cluster/v1beta1/types.go index c0691ea72..af96e1db7 100644 --- a/cluster/v1beta1/types.go +++ b/cluster/v1beta1/types.go @@ -43,6 +43,9 @@ type ManagedClusterSetSpec struct { // ManagedClusterSetStatus represents the current status of the ManagedClusterSet. type ManagedClusterSetStatus struct { // Conditions contains the different condition statuses for this ManagedClusterSet. + // +listMapKey:=type + // +listType:=map + // +optional Conditions []metav1.Condition `json:"conditions"` } 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 a4d185668..5945a084f 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 @@ -212,6 +212,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map generations: description: Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. 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 eef7cf44d..851215278 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 @@ -186,6 +186,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map generations: description: Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. diff --git a/operator/v1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml b/operator/v1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml index 3e6ea4eae..33886d57b 100644 --- a/operator/v1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml +++ b/operator/v1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml @@ -209,6 +209,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map generations: description: Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. diff --git a/operator/v1/types.go b/operator/v1/types.go index 8ad49f53b..dd391ff9e 100644 --- a/operator/v1/types.go +++ b/operator/v1/types.go @@ -60,6 +60,8 @@ type ClusterManagerStatus struct { // Progressing: Components in hub are in a transitioning state. // Degraded: Components in hub do not match the desired configuration and only provide // degraded service. + // +listMapKey:=type + // +listType:=map Conditions []metav1.Condition `json:"conditions"` // Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. @@ -225,6 +227,8 @@ type KlusterletStatus struct { // Progressing: Components in the managed cluster are in a transitioning state. // Degraded: Components in the managed cluster do not match the desired configuration and only provide // degraded service. + // +listMapKey:=type + // +listType:=map Conditions []metav1.Condition `json:"conditions"` // Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction. diff --git a/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml b/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml index 617c767f7..1c3068491 100644 --- a/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml +++ b/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml @@ -183,6 +183,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map resourceStatus: description: ResourceStatus represents the status of each resource in manifestwork deployed on a managed cluster. The Klusterlet agent @@ -283,6 +286,9 @@ spec: type: string maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map resourceMeta: description: ResourceMeta represents the group, version, kind, name and namespace of a resoure. diff --git a/work/v1/types.go b/work/v1/types.go index d003a386c..2d564c5b0 100644 --- a/work/v1/types.go +++ b/work/v1/types.go @@ -175,6 +175,8 @@ type ManifestWorkStatus struct { // 3. Available represents workload in ManifestWork exists on the managed cluster. // 4. Degraded represents the current state of workload does not match the desired // state for a certain period. + // +listMapKey:=type + // +listType:=map Conditions []metav1.Condition `json:"conditions,omitempty"` // ResourceStatus represents the status of each resource in manifestwork deployed on a @@ -219,6 +221,8 @@ type ManifestCondition struct { ResourceMeta ManifestResourceMeta `json:"resourceMeta"` // Conditions represents the conditions of this resource on a managed cluster. + // +listMapKey:=type + // +listType:=map // +required Conditions []metav1.Condition `json:"conditions"` }