Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cluster supports specifing pvc annotations and labels #8799

Open
wants to merge 7 commits into
base: release-0.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,16 @@ type ClusterSwitchPolicy struct {
}

type ClusterComponentVolumeClaimTemplate struct {
// Specifies Labels to override or add for the PVC.
gnolong marked this conversation as resolved.
Show resolved Hide resolved
//
// +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`
Expand Down
14 changes: 14 additions & 0 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
23 changes: 23 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_opsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
48 changes: 48 additions & 0 deletions deploy/helm/crds/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
23 changes: 23 additions & 0 deletions deploy/helm/crds/apps.kubeblocks.io_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions docs/developer_docs/api-reference/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -5888,6 +5888,30 @@ This overrides the image and env attributes defined in clusterDefinition.spec.co
<tbody>
<tr>
<td>
<code>labels</code><br/>
<em>
map[string]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies Labels to override or add for the PVC.</p>
</td>
</tr>
<tr>
<td>
<code>annotations</code><br/>
<em>
map[string]string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies Annotations to override or add for the PVC.</p>
</td>
</tr>
<tr>
<td>
<code>name</code><br/>
<em>
string
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/component/synthesize_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
gnolong marked this conversation as resolved.
Show resolved Hide resolved
Spec: t.Spec.ToV1PersistentVolumeClaimSpec(),
})
Expand Down
Loading