8000 feat: support specifying the volume attributes class for PVCs by leon-inf · Pull Request #8783 · apecloud/kubeblocks · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: support specifying the volume attributes class for PVCs #8783

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

Merged
merged 2 commits into from
Jan 10, 2025
Merged
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
17 changes: 9 additions & 8 deletions apis/apps/v1/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,22 @@ func (r *ClusterComponentVolumeClaimTemplate) toVolumeClaimTemplate() corev1.Per

func (r *PersistentVolumeClaimSpec) ToV1PersistentVolumeClaimSpec() corev1.PersistentVolumeClaimSpec {
return corev1.PersistentVolumeClaimSpec{
AccessModes: r.AccessModes,
Resources: r.Resources,
StorageClassName: r.getStorageClassName(viper.GetString(constant.CfgKeyDefaultStorageClass)),
VolumeMode: r.VolumeMode,
AccessModes: r.AccessModes,
Resources: r.Resources,
StorageClassName: r.getStorageClassName(viper.GetString(constant.CfgKeyDefaultStorageClass)),
VolumeMode: r.VolumeMode,
VolumeAttributesClassName: r.VolumeAttributesClassName,
}
}

// getStorageClassName returns PersistentVolumeClaimSpec.StorageClassName if a value is assigned; otherwise,
// it returns preferSC argument.
func (r *PersistentVolumeClaimSpec) getStorageClassName(preferSC string) *string {
// it returns the defaultStorageClass argument.
func (r *PersistentVolumeClaimSpec) getStorageClassName(defaultStorageClass string) *string {
if r.StorageClassName != nil && *r.StorageClassName != "" {
return r.StorageClassName
}
if preferSC != "" {
return &preferSC
if defaultStorageClass != "" {
return &defaultStorageClass
}
return nil
}
Expand Down
7 changes: 7 additions & 0 deletions apis/apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ type PersistentVolumeClaimSpec struct {
//
// +optional
VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`

// volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.
//
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
//
// +optional
VolumeAttributesClassName *string `json:"volumeAttributesClassName,omitempty"`
}

type Service struct {
Expand Down
5 changes: 5 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.

28 changes: 28 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is
required by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -5461,6 +5468,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -10615,6 +10629,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
ED4F volumeMode:
description: Defines what type of volume
is required by the claim, either Block
Expand Down Expand Up @@ -14198,6 +14219,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/apps.kubeblocks.io_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -5720,6 +5727,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required by
the claim, either Block or Filesystem.
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/operations.kubeblocks.io_opsrequests.yaml
F438
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume
is required by the claim, either Block
Expand Down Expand Up @@ -6719,6 +6726,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume
is required by the claim, either Block
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func (r *componentWorkloadOps) expandVolume() error {
protoVCTs = append(protoVCTs, r.synthesizeComp.VolumeClaimTemplates...)
for _, v := range r.synthesizeComp.Instances {
if runningInsTPL.Name == v.Name {
insVCTs := component.ToVolumeClaimTemplates(v.VolumeClaimTemplates)
insVCTs := intctrlutil.ToCoreV1PVCTs(v.VolumeClaimTemplates)
intctrlutil.MergeList(&insVCTs, &protoVCTs,
func(item corev1.PersistentVolumeClaimTemplate) func(corev1.PersistentVolumeClaimTemplate) bool {
return func(claim corev1.PersistentVolumeClaimTemplate) bool {
Expand Down
28 changes: 28 additions & 0 deletions deploy/helm/crds/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is
required by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -5461,6 +5468,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -10615,6 +10629,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume
is required by the claim, either Block
Expand Down Expand Up @@ -14198,6 +14219,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down
14 changes: 14 additions & 0 deletions deploy/helm/crds/apps.kubeblocks.io_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down Expand Up @@ -5720,6 +5727,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required by
the claim, either Block or Filesystem.
Expand Down
14 changes: 14 additions & 0 deletions deploy/helm/crds/operations.kubeblocks.io_opsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume
is required by the claim, either Block
Expand Down Expand Up @@ -6719,6 +6726,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
B93C description: Defines what type of volume
is required by the claim, either Block
Expand Down
7 changes: 7 additions & 0 deletions deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,13 @@ spec:
The name of the StorageClass required by the claim.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
type: string
volumeAttributesClassName:
description: |-
volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim.


More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#volumeattributesclass
type: string
volumeMode:
description: Defines what type of volume is required
by the claim, either Block or Filesystem.
Expand Down
Loading
Loading
0