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 #8804

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion apis/apps/v1/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ func (r *ClusterComponentStatus) GetObjectMessage(objectKind, objectName string)
func (r *ClusterComponentVolumeClaimTemplate) toVolumeClaimTemplate() corev1.PersistentVolumeClaimTemplate {
return corev1.PersistentVolumeClaimTemplate{
ObjectMeta: metav1.ObjectMeta{
Name: r.Name,
Labels: r.Labels,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to this PR and consolidate the transformation of VCTs to PVCs and PVCTs: #8809

Annotations: r.Annotations,
Name: r.Name,
},
Spec: r.Spec.ToV1PersistentVolumeClaimSpec(),
}
Expand Down
10 changes: 10 additions & 0 deletions apis/apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ type ServiceRefCredentialSelector 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`
Expand Down
14 changes: 14 additions & 0 deletions apis/apps/v1/zz_generated.deepcopy.go

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

14 changes: 13 additions & 1 deletion apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,16 @@ 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`
Expand All @@ -1003,7 +1013,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(),
}
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.

94 changes: 94 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -5410,6 +5422,17 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -10571,6 +10594,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -14161,6 +14196,18 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -18303,6 +18350,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -22149,6 +22208,17 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -27496,6 +27566,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -31387,6 +31469,18 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down
42 changes: 42 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,17 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -5661,6 +5672,16 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -9383,6 +9404,17 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -13331,6 +13363,16 @@ spec:
These templates are used to dynamically provision persistent volumes for the Component.
items:
properties:
annotations:
additionalProperties:
type: string
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.
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/operations.kubeblocks.io_opsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down Expand Up @@ -6674,6 +6686,18 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down
11 changes: 11 additions & 0 deletions config/crd/bases/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,17 @@ spec:
Add new or override existing volume claim templates.
items:
properties:
annotations:
additionalProperties:
type: string
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.
type: object
name:
description: |-
Refers to the name of a volumeMount defined in either:
Expand Down
6 changes: 6 additions & 0 deletions config/samples/apps_v1alpha1_opsdefinition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsDefinition
metadata:
name: opsdefinition-sample
spec:
# TODO(user): Add fields here
Loading
Loading