From d976069c5b9e2f9b1294bb02ad51bc2b6058180c Mon Sep 17 00:00:00 2001 From: hongming Date: Wed, 28 Jun 2023 18:03:28 +0800 Subject: [PATCH] Fix: require cluster name can not be repeated (#5795) Signed-off-by: wenhaozhou Co-authored-by: Wenhao Zhou <34303854+zhou1203@users.noreply.github.com> --- .../ks-core/crds/tenant.kubesphere.io_workspacetemplates.yaml | 3 +++ staging/src/kubesphere.io/api/types/v1beta1/types.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/config/ks-core/crds/tenant.kubesphere.io_workspacetemplates.yaml b/config/ks-core/crds/tenant.kubesphere.io_workspacetemplates.yaml index 2eba76994..0cec2b574 100644 --- a/config/ks-core/crds/tenant.kubesphere.io_workspacetemplates.yaml +++ b/config/ks-core/crds/tenant.kubesphere.io_workspacetemplates.yaml @@ -118,6 +118,9 @@ spec: - name type: object type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map type: object template: properties: diff --git a/staging/src/kubesphere.io/api/types/v1beta1/types.go b/staging/src/kubesphere.io/api/types/v1beta1/types.go index 4b1786e60..5b46c4d4b 100644 --- a/staging/src/kubesphere.io/api/types/v1beta1/types.go +++ b/staging/src/kubesphere.io/api/types/v1beta1/types.go @@ -29,6 +29,8 @@ type GenericClusterReference struct { } type GenericPlacementFields struct { + // +listType=map + // +listMapKey=name Clusters []GenericClusterReference `json:"clusters,omitempty"` ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` }