From ce90d40d962a2cf1f0b569fe4d219e1b7b30b13f Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Mon, 13 Jan 2025 19:27:50 +0800 Subject: [PATCH 01/10] fix: cluster supports specifing pvc annotations and labels --- apis/apps/v1alpha1/cluster_types.go | 10 ++++ .../bases/apps.kubeblocks.io_clusters.yaml | 48 +++++++++++++++++++ .../bases/apps.kubeblocks.io_components.yaml | 23 +++++++++ .../bases/apps.kubeblocks.io_opsrequests.yaml | 24 ++++++++++ .../crds/apps.kubeblocks.io_clusters.yaml | 48 +++++++++++++++++++ .../crds/apps.kubeblocks.io_components.yaml | 23 +++++++++ .../crds/apps.kubeblocks.io_opsrequests.yaml | 24 ++++++++++ .../component/synthesize_component.go | 2 + 8 files changed, 202 insertions(+) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index 9eab7918c01..355ebb36df3 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -988,6 +988,16 @@ type ClusterSwitchPolicy struct { } type ClusterComponentVolumeClaimTemplate struct { + // Specifies Labels to override or add for the PVC. + // + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // Specifies Annotations to override or add for the PVC. + // + // +optional + Annotations map[string]string `json:"annotations,omitempty"` + // Refers to the name of a volumeMount defined in either: // // - `componentDefinition.spec.runtime.containers[*].volumeMounts` diff --git a/config/crd/bases/apps.kubeblocks.io_clusters.yaml b/config/crd/bases/apps.kubeblocks.io_clusters.yaml index 7ee4c7e8aee..a2bd86aca44 100644 --- a/config/crd/bases/apps.kubeblocks.io_clusters.yaml +++ b/config/crd/bases/apps.kubeblocks.io_clusters.yaml @@ -1917,6 +1917,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or + add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add + for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -5573,6 +5585,18 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add + for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the + PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -10524,6 +10548,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -14225,6 +14261,18 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or + add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for + the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/config/crd/bases/apps.kubeblocks.io_components.yaml b/config/crd/bases/apps.kubeblocks.io_components.yaml index f623183f7df..3bd7bf3b83f 100644 --- a/config/crd/bases/apps.kubeblocks.io_components.yaml +++ b/config/crd/bases/apps.kubeblocks.io_components.yaml @@ -1817,6 +1817,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add + for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the + PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -5575,6 +5587,17 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add for the + PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml index 87d3cace21e..5fbff8f6968 100644 --- a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml +++ b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml @@ -1931,6 +1931,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -6767,6 +6779,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml index 7ee4c7e8aee..a2bd86aca44 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml @@ -1917,6 +1917,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or + add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add + for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -5573,6 +5585,18 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add + for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the + PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -10524,6 +10548,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -14225,6 +14261,18 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or + add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for + the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/deploy/helm/crds/apps.kubeblocks.io_components.yaml b/deploy/helm/crds/apps.kubeblocks.io_components.yaml index f623183f7df..3bd7bf3b83f 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_components.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_components.yaml @@ -1817,6 +1817,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add + for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the + PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -5575,6 +5587,17 @@ spec: These templates are used to dynamically provision persistent volumes for the Component. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override or add for the + PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml index 87d3cace21e..5fbff8f6968 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml @@ -1931,6 +1931,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: @@ -6767,6 +6779,18 @@ spec: Add new or override existing volume claim templates. items: properties: + annotations: + additionalProperties: + type: string + description: Specifies Annotations to override + or add for the PVC. + type: object + labels: + additionalProperties: + type: string + description: Specifies Labels to override or + add for the PVC. + type: object name: description: |- Refers to the name of a volumeMount defined in either: diff --git a/pkg/controller/component/synthesize_component.go b/pkg/controller/component/synthesize_component.go index 1bee9e023c4..50e7ec0425d 100644 --- a/pkg/controller/component/synthesize_component.go +++ b/pkg/controller/component/synthesize_component.go @@ -509,6 +509,8 @@ func toVolumeClaimTemplates(compSpec *appsv1alpha1.ComponentSpec) []corev1.Persi ts = append(ts, corev1.PersistentVolumeClaimTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: t.Name, + Annotations: t.Annotations, + Labels: t.Labels, }, Spec: t.Spec.ToV1PersistentVolumeClaimSpec(), }) From 6cf15a9dc6fd837a9543a8ca5250a3e8c84f08d6 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Mon, 13 Jan 2025 19:39:16 +0800 Subject: [PATCH 02/10] fix doc --- apis/apps/v1alpha1/zz_generated.deepcopy.go | 14 ++++++++++++ docs/developer_docs/api-reference/cluster.md | 24 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/apis/apps/v1alpha1/zz_generated.deepcopy.go b/apis/apps/v1alpha1/zz_generated.deepcopy.go index c80761e05a3..399f1aa1b2c 100644 --- a/apis/apps/v1alpha1/zz_generated.deepcopy.go +++ b/apis/apps/v1alpha1/zz_generated.deepcopy.go @@ -825,6 +825,20 @@ func (in *ClusterComponentVersion) DeepCopy() *ClusterComponentVersion { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterComponentVolumeClaimTemplate) DeepCopyInto(out *ClusterComponentVolumeClaimTemplate) { *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } in.Spec.DeepCopyInto(&out.Spec) } diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index a2427b52e03..1a893e96dd4 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -5888,6 +5888,30 @@ This overrides the image and env attributes defined in clusterDefinition.spec.co +labels
+ +map[string]string + + + +(Optional) +

Specifies Labels to override or add for the PVC.

+ + + + +annotations
+ +map[string]string + + + +(Optional) +

Specifies Annotations to override or add for the PVC.

+ + + + name
string From 551a62a4ed320192057c42b318c3e2d1a5aeabfe Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Tue, 14 Jan 2025 13:43:26 +0800 Subject: [PATCH 03/10] based on comment --- apis/apps/v1alpha1/cluster_types.go | 4 +++- pkg/controller/component/synthesize_component.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index 355ebb36df3..7b81425ee21 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -1021,7 +1021,9 @@ type ClusterComponentVolumeClaimTemplate struct { func (r *ClusterComponentVolumeClaimTemplate) toVolumeClaimTemplate() corev1.PersistentVolumeClaimTemplate { return corev1.PersistentVolumeClaimTemplate{ ObjectMeta: metav1.ObjectMeta{ - Name: r.Name, + Labels: r.Labels, + Annotations: r.Annotations, + Name: r.Name, }, Spec: r.Spec.ToV1PersistentVolumeClaimSpec(), } diff --git a/pkg/controller/component/synthesize_component.go b/pkg/controller/component/synthesize_component.go index 50e7ec0425d..cefbcf97850 100644 --- a/pkg/controller/component/synthesize_component.go +++ b/pkg/controller/component/synthesize_component.go @@ -508,9 +508,9 @@ func toVolumeClaimTemplates(compSpec *appsv1alpha1.ComponentSpec) []corev1.Persi for _, t := range compSpec.VolumeClaimTemplates { ts = append(ts, corev1.PersistentVolumeClaimTemplate{ ObjectMeta: metav1.ObjectMeta{ - Name: t.Name, + Labels: t.Labels, Annotations: t.Annotations, - Labels: t.Labels, + Name: t.Name, }, Spec: t.Spec.ToV1PersistentVolumeClaimSpec(), }) From 1ad4c3c66e828d13199ab16959d8223c7732f434 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Wed, 15 Jan 2025 15:26:35 +0800 Subject: [PATCH 04/10] fix doc --- apis/apps/v1alpha1/cluster_types.go | 6 ++- .../bases/apps.kubeblocks.io_clusters.yaml | 40 +++++++++++-------- .../bases/apps.kubeblocks.io_components.yaml | 19 +++++---- .../bases/apps.kubeblocks.io_opsrequests.yaml | 20 ++++++---- .../crds/apps.kubeblocks.io_clusters.yaml | 40 +++++++++++-------- .../crds/apps.kubeblocks.io_components.yaml | 19 +++++---- .../crds/apps.kubeblocks.io_opsrequests.yaml | 20 ++++++---- docs/developer_docs/api-reference/cluster.md | 6 ++- pkg/controller/component/rsm_convertor.go | 2 + 9 files changed, 106 insertions(+), 66 deletions(-) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index 7b81425ee21..bc5d71ed350 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -988,12 +988,14 @@ type ClusterSwitchPolicy struct { } type ClusterComponentVolumeClaimTemplate struct { - // Specifies Labels to override or add for the PVC. + // Specifies the labels for the PVC of the volume. These labels can be overridden + // by labels defined at a higher level in the specification. // // +optional Labels map[string]string `json:"labels,omitempty"` - // Specifies Annotations to override or add for the PVC. + // Specifies the annotations for the PVC of the volume. These annotations can be overridden + // by annotations defined at a higher level in the specification. // // +optional Annotations map[string]string `json:"annotations,omitempty"` diff --git a/config/crd/bases/apps.kubeblocks.io_clusters.yaml b/config/crd/bases/apps.kubeblocks.io_clusters.yaml index a2bd86aca44..3bcfdc62f5d 100644 --- a/config/crd/bases/apps.kubeblocks.io_clusters.yaml +++ b/config/crd/bases/apps.kubeblocks.io_clusters.yaml @@ -1920,14 +1920,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or - add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add - for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -5588,14 +5590,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add - for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the - PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -10551,14 +10555,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -14264,14 +14270,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or - add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for - the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/config/crd/bases/apps.kubeblocks.io_components.yaml b/config/crd/bases/apps.kubeblocks.io_components.yaml index 3bd7bf3b83f..47e9eb9321d 100644 --- a/config/crd/bases/apps.kubeblocks.io_components.yaml +++ b/config/crd/bases/apps.kubeblocks.io_components.yaml @@ -1820,14 +1820,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add - for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the - PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -5590,13 +5592,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add for the - PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml index 5fbff8f6968..9d16381e6be 100644 --- a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml +++ b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml @@ -1934,14 +1934,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -6782,14 +6784,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml index a2bd86aca44..3bcfdc62f5d 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml @@ -1920,14 +1920,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or - add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add - for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -5588,14 +5590,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add - for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the - PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -10551,14 +10555,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -14264,14 +14270,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or - add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for - the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_components.yaml b/deploy/helm/crds/apps.kubeblocks.io_components.yaml index 3bd7bf3b83f..47e9eb9321d 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_components.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_components.yaml @@ -1820,14 +1820,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add - for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the - PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -5590,13 +5592,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override or add for the - PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml index 5fbff8f6968..9d16381e6be 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml @@ -1934,14 +1934,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- @@ -6782,14 +6784,16 @@ spec: annotations: additionalProperties: type: string - description: Specifies Annotations to override - or add for the PVC. + description: |- + Specifies the annotations for the PVC of the volume. These annotations can be overridden + by annotations defined at a higher level in the specification. type: object labels: additionalProperties: type: string - description: Specifies Labels to override or - add for the PVC. + description: |- + Specifies the labels for the PVC of the volume. These labels can be overridden + by labels defined at a higher level in the specification. type: object name: description: |- diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index 1a893e96dd4..aba61c24772 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -5895,7 +5895,8 @@ map[string]string (Optional) -

Specifies Labels to override or add for the PVC.

+

Specifies the labels for the PVC of the volume. These labels can be overridden +by labels defined at a higher level in the specification.

@@ -5907,7 +5908,8 @@ map[string]string (Optional) -

Specifies Annotations to override or add for the PVC.

+

Specifies the annotations for the PVC of the volume. These annotations can be overridden +by annotations defined at a higher level in the specification.

diff --git a/pkg/controller/component/rsm_convertor.go b/pkg/controller/component/rsm_convertor.go index ee007166f47..447cb0efcb0 100644 --- a/pkg/controller/component/rsm_convertor.go +++ b/pkg/controller/component/rsm_convertor.go @@ -227,6 +227,8 @@ func toPersistentVolumeClaims(vcts []appsv1alpha1.ClusterComponentVolumeClaimTem for _, v := range vcts { pvcs = append(pvcs, corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ + Labels: v.Labels, + Annotations: v.Annotations, Name: v.Name, }, Spec: v.Spec.ToV1PersistentVolumeClaimSpec(), From b48524206a83f39ba875c3adb9e86bc9b80a853a Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Wed, 15 Jan 2025 15:40:37 +0800 Subject: [PATCH 05/10] fix lint --- pkg/controller/component/rsm_convertor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/controller/component/rsm_convertor.go b/pkg/controller/component/rsm_convertor.go index 447cb0efcb0..9e5862cfb30 100644 --- a/pkg/controller/component/rsm_convertor.go +++ b/pkg/controller/component/rsm_convertor.go @@ -227,9 +227,9 @@ func toPersistentVolumeClaims(vcts []appsv1alpha1.ClusterComponentVolumeClaimTem for _, v := range vcts { pvcs = append(pvcs, corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ - Labels: v.Labels, + Labels: v.Labels, Annotations: v.Annotations, - Name: v.Name, + Name: v.Name, }, Spec: v.Spec.ToV1PersistentVolumeClaimSpec(), }) From 2488bccb4c381a2573424c2b8b315d45c58fce7f Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Fri, 17 Jan 2025 20:02:45 +0800 Subject: [PATCH 06/10] fix --- apis/apps/v1alpha1/cluster_types.go | 6 +-- .../bases/apps.kubeblocks.io_clusters.yaml | 39 +++++++------------ .../bases/apps.kubeblocks.io_components.yaml | 17 +++----- .../bases/apps.kubeblocks.io_opsrequests.yaml | 20 ++++------ .../crds/apps.kubeblocks.io_clusters.yaml | 39 +++++++------------ .../crds/apps.kubeblocks.io_components.yaml | 17 +++----- .../crds/apps.kubeblocks.io_opsrequests.yaml | 20 ++++------ docs/developer_docs/api-reference/cluster.md | 6 +-- 8 files changed, 60 insertions(+), 104 deletions(-) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index bc5d71ed350..7e9c2ea52c4 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -988,14 +988,12 @@ type ClusterSwitchPolicy struct { } type ClusterComponentVolumeClaimTemplate struct { - // Specifies the labels for the PVC of the volume. These labels can be overridden - // by labels defined at a higher level in the specification. + // Specifies the labels for the PVC of the volume. // // +optional Labels map[string]string `json:"labels,omitempty"` - // Specifies the annotations for the PVC of the volume. These annotations can be overridden - // by annotations defined at a higher level in the specification. + // Specifies the annotations for the PVC of the volume. // // +optional Annotations map[string]string `json:"annotations,omitempty"` diff --git a/config/crd/bases/apps.kubeblocks.io_clusters.yaml b/config/crd/bases/apps.kubeblocks.io_clusters.yaml index 3bcfdc62f5d..e5c719168d2 100644 --- a/config/crd/bases/apps.kubeblocks.io_clusters.yaml +++ b/config/crd/bases/apps.kubeblocks.io_clusters.yaml @@ -1920,16 +1920,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC + of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of + the volume. type: object name: description: |- @@ -5590,16 +5588,13 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of + the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- @@ -10555,16 +10550,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- @@ -14270,16 +14263,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC + of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the + volume. type: object name: description: |- diff --git a/config/crd/bases/apps.kubeblocks.io_components.yaml b/config/crd/bases/apps.kubeblocks.io_components.yaml index 47e9eb9321d..63f135dc583 100644 --- a/config/crd/bases/apps.kubeblocks.io_components.yaml +++ b/config/crd/bases/apps.kubeblocks.io_components.yaml @@ -1820,16 +1820,13 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of + the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- @@ -5592,16 +5589,12 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- diff --git a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml index 9d16381e6be..f25f73bed36 100644 --- a/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml +++ b/config/crd/bases/apps.kubeblocks.io_opsrequests.yaml @@ -1934,16 +1934,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- @@ -6784,16 +6782,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml index 3bcfdc62f5d..e5c719168d2 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml @@ -1920,16 +1920,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC + of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of + the volume. type: object name: description: |- @@ -5590,16 +5588,13 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of + the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- @@ -10555,16 +10550,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- @@ -14270,16 +14263,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC + of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the + volume. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_components.yaml b/deploy/helm/crds/apps.kubeblocks.io_components.yaml index 47e9eb9321d..63f135dc583 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_components.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_components.yaml @@ -1820,16 +1820,13 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of + the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- @@ -5592,16 +5589,12 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC of the volume. type: object name: description: |- diff --git a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml index 9d16381e6be..f25f73bed36 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml @@ -1934,16 +1934,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- @@ -6784,16 +6782,14 @@ spec: annotations: additionalProperties: type: string - description: |- - Specifies the annotations for the PVC of the volume. These annotations can be overridden - by annotations defined at a higher level in the specification. + description: Specifies the annotations for the + PVC of the volume. type: object labels: additionalProperties: type: string - description: |- - Specifies the labels for the PVC of the volume. These labels can be overridden - by labels defined at a higher level in the specification. + description: Specifies the labels for the PVC + of the volume. type: object name: description: |- diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index aba61c24772..4520218116e 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -5895,8 +5895,7 @@ map[string]string (Optional) -

Specifies the labels for the PVC of the volume. These labels can be overridden -by labels defined at a higher level in the specification.

+

Specifies the labels for the PVC of the volume.

@@ -5908,8 +5907,7 @@ map[string]string (Optional) -

Specifies the annotations for the PVC of the volume. These annotations can be overridden -by annotations defined at a higher level in the specification.

+

Specifies the annotations for the PVC of the volume.

From 0a266a65cbeece288db55cf906f6c065779198b8 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Fri, 21 Feb 2025 14:35:36 +0800 Subject: [PATCH 07/10] fix doc --- apis/apps/v1alpha1/cluster_types.go | 20 +++++++------- docs/developer_docs/api-reference/cluster.md | 28 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index 7e9c2ea52c4..41512250273 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -988,16 +988,6 @@ type ClusterSwitchPolicy struct { } type ClusterComponentVolumeClaimTemplate struct { - // Specifies the labels for the PVC of the volume. - // - // +optional - Labels map[string]string `json:"labels,omitempty"` - - // Specifies the annotations for the PVC of the volume. - // - // +optional - Annotations map[string]string `json:"annotations,omitempty"` - // Refers to the name of a volumeMount defined in either: // // - `componentDefinition.spec.runtime.containers[*].volumeMounts` @@ -1008,6 +998,16 @@ type ClusterComponentVolumeClaimTemplate struct { // +kubebuilder:validation:Required Name string `json:"name"` + // Specifies the labels for the PVC of the volume. + // + // +optional + Labels map[string]string `json:"labels,omitempty"` + + // Specifies the annotations for the PVC of the volume. + // + // +optional + Annotations map[string]string `json:"annotations,omitempty"` + // Defines the desired characteristics of a PersistentVolumeClaim that will be created for the volume // with the mount name specified in the `name` field. // diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index 4520218116e..66110ebd905 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -5888,42 +5888,42 @@ This overrides the image and env attributes defined in clusterDefinition.spec.co -labels
+name
-map[string]string +string -(Optional) -

Specifies the labels for the PVC of the volume.

+

Refers to the name of a volumeMount defined in either:

+ +

The value of name must match the name field of a volumeMount specified in the corresponding volumeMounts array.

-annotations
+labels
map[string]string (Optional) -

Specifies the annotations for the PVC of the volume.

+

Specifies the labels for the PVC of the volume.

-name
+annotations
-string +map[string]string -

Refers to the name of a volumeMount defined in either:

- -

The value of name must match the name field of a volumeMount specified in the corresponding volumeMounts array.

+(Optional) +

Specifies the annotations for the PVC of the volume.

From 2d6dfc87c1003a3d803dff6414d9314e79d9a752 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Fri, 21 Feb 2025 16:49:24 +0800 Subject: [PATCH 08/10] ci --- pkg/testutil/apps/cluster_util.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/testutil/apps/cluster_util.go b/pkg/testutil/apps/cluster_util.go index b461c94473e..feadbc1eb1f 100644 --- a/pkg/testutil/apps/cluster_util.go +++ b/pkg/testutil/apps/cluster_util.go @@ -82,8 +82,7 @@ func CheckedCreateK8sResource(testCtx *testutil.TestContext, obj client.Object) func GetClusterComponentPhase(testCtx *testutil.TestContext, clusterKey types.NamespacedName, componentName string) func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase { return func(g gomega.Gomega) appsv1alpha1.ClusterComponentPhase { tmpCluster := &appsv1alpha1.Cluster{} - g.Expect(testCtx.Cli.Get(context.Background(), client.ObjectKey{Name: clusterKey.Name, - Namespace: clusterKey.Namespace}, tmpCluster)).Should(gomega.Succeed()) + g.Expect(testCtx.Cli.Get(testCtx.Ctx, clusterKey, tmpCluster)).Should(gomega.Succeed()) return tmpCluster.Status.Components[componentName].Phase } } From 34aa92bf69136e64164c547716b988329d509130 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Fri, 21 Feb 2025 16:59:04 +0800 Subject: [PATCH 09/10] ci --- pkg/testutil/apps/cluster_util.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/testutil/apps/cluster_util.go b/pkg/testutil/apps/cluster_util.go index feadbc1eb1f..f19f25321b1 100644 --- a/pkg/testutil/apps/cluster_util.go +++ b/pkg/testutil/apps/cluster_util.go @@ -20,8 +20,6 @@ along with this program. If not, see . package apps import ( - "context" - "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" From f2b9c2ddf3d406f4d0a154d7cebefc0efad65d41 Mon Sep 17 00:00:00 2001 From: gnolong <2391353625@qq.com> Date: Fri, 21 Feb 2025 17:41:07 +0800 Subject: [PATCH 10/10] fix --- apis/apps/v1alpha1/cluster_types.go | 4 ++-- apis/apps/v1alpha1/cluster_types_test.go | 2 +- pkg/controller/component/synthesize_component.go | 9 +-------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apis/apps/v1alpha1/cluster_types.go b/apis/apps/v1alpha1/cluster_types.go index 41512250273..4c4357018a9 100644 --- a/apis/apps/v1alpha1/cluster_types.go +++ b/apis/apps/v1alpha1/cluster_types.go @@ -1018,7 +1018,7 @@ type ClusterComponentVolumeClaimTemplate struct { Spec PersistentVolumeClaimSpec `json:"spec,omitempty"` } -func (r *ClusterComponentVolumeClaimTemplate) toVolumeClaimTemplate() corev1.PersistentVolumeClaimTemplate { +func (r *ClusterComponentVolumeClaimTemplate) ToVolumeClaimTemplate() corev1.PersistentVolumeClaimTemplate { return corev1.PersistentVolumeClaimTemplate{ ObjectMeta: metav1.ObjectMeta{ Labels: r.Labels, @@ -1708,7 +1708,7 @@ func (r *ClusterComponentSpec) ToVolumeClaimTemplates() []corev1.PersistentVolum } var ts []corev1.PersistentVolumeClaimTemplate for _, t := range r.VolumeClaimTemplates { - ts = append(ts, t.toVolumeClaimTemplate()) + ts = append(ts, t.ToVolumeClaimTemplate()) } return ts } diff --git a/apis/apps/v1alpha1/cluster_types_test.go b/apis/apps/v1alpha1/cluster_types_test.go index 06a8f791566..4aa41561278 100644 --- a/apis/apps/v1alpha1/cluster_types_test.go +++ b/apis/apps/v1alpha1/cluster_types_test.go @@ -36,7 +36,7 @@ var _ = Describe("", func() { It("test toVolumeClaimTemplate", func() { r := ClusterComponentVolumeClaimTemplate{} r.Name = "test-name" - Expect(r.toVolumeClaimTemplate().ObjectMeta.Name).Should(BeEquivalentTo(r.Name)) + Expect(r.ToVolumeClaimTemplate().ObjectMeta.Name).Should(BeEquivalentTo(r.Name)) }) It("test ToV1PersistentVolumeClaimSpec", func() { diff --git a/pkg/controller/component/synthesize_component.go b/pkg/controller/component/synthesize_component.go index cefbcf97850..18303bd4c39 100644 --- a/pkg/controller/component/synthesize_component.go +++ b/pkg/controller/component/synthesize_component.go @@ -506,14 +506,7 @@ func limitSharedMemoryVolumeSize(synthesizeComp *SynthesizedComponent, comp *app func toVolumeClaimTemplates(compSpec *appsv1alpha1.ComponentSpec) []corev1.PersistentVolumeClaimTemplate { var ts []corev1.PersistentVolumeClaimTemplate for _, t := range compSpec.VolumeClaimTemplates { - ts = append(ts, corev1.PersistentVolumeClaimTemplate{ - ObjectMeta: metav1.ObjectMeta{ - Labels: t.Labels, - Annotations: t.Annotations, - Name: t.Name, - }, - Spec: t.Spec.ToV1PersistentVolumeClaimSpec(), - }) + ts = append(ts, t.ToVolumeClaimTemplate()) } return ts }