From ad6f22c7159d32a7b9e8f23fffe93eba3c36b4fc Mon Sep 17 00:00:00 2001 From: "Roland.Ma" Date: Fri, 23 Apr 2021 05:21:49 +0000 Subject: [PATCH 1/2] add RawExtension type annotation Signed-off-by: Roland.Ma --- config/crds/iam.kubesphere.io_rolebases.yaml | 2 ++ staging/src/kubesphere.io/api/iam/v1alpha2/types.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/crds/iam.kubesphere.io_rolebases.yaml b/config/crds/iam.kubesphere.io_rolebases.yaml index 35183c630..8b70b38ad 100644 --- a/config/crds/iam.kubesphere.io_rolebases.yaml +++ b/config/crds/iam.kubesphere.io_rolebases.yaml @@ -32,6 +32,8 @@ spec: type: object role: type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true required: - role type: object diff --git a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go index 8243641bb..d5167698b 100644 --- a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go +++ b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go @@ -283,7 +283,8 @@ type WorkspaceRoleBindingList struct { type RoleBase struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:EmbeddedResource Role runtime.RawExtension `json:"role"` } From b05ef6714c54cea4443b6e3bf65feba2e3b469e7 Mon Sep 17 00:00:00 2001 From: "Roland.Ma" Date: Fri, 23 Apr 2021 10:41:29 +0000 Subject: [PATCH 2/2] fix ClusterOverride field Signed-off-by: Roland.Ma --- config/crds/tenant.kubesphere.io_workspacetemplates.yaml | 1 + staging/src/kubesphere.io/api/types/v1beta1/types.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/crds/tenant.kubesphere.io_workspacetemplates.yaml b/config/crds/tenant.kubesphere.io_workspacetemplates.yaml index a7450d006..9502a4101 100644 --- a/config/crds/tenant.kubesphere.io_workspacetemplates.yaml +++ b/config/crds/tenant.kubesphere.io_workspacetemplates.yaml @@ -47,6 +47,7 @@ spec: type: string value: type: object + x-kubernetes-preserve-unknown-fields: true required: - path type: object diff --git a/staging/src/kubesphere.io/api/types/v1beta1/types.go b/staging/src/kubesphere.io/api/types/v1beta1/types.go index 30379b0e2..4b1786e60 100644 --- a/staging/src/kubesphere.io/api/types/v1beta1/types.go +++ b/staging/src/kubesphere.io/api/types/v1beta1/types.go @@ -44,8 +44,9 @@ type GenericPlacement struct { } type ClusterOverride struct { - Op string `json:"op,omitempty"` - Path string `json:"path"` + Op string `json:"op,omitempty"` + Path string `json:"path"` + // +kubebuilder:pruning:PreserveUnknownFields Value runtime.RawExtension `json:"value,omitempty"` }