Skip to content

Commit

Permalink
helm: allow custom labels and annotations for storage classes
Browse files Browse the repository at this point in the history
Storage classes were missing the possilbilty to attach custom labels and
annotations. This change brings it on par with VolumeSnapshotClass
objects.

Signed-off-by: Peter Dahlberg <catdog2@tuxzone.org>
  • Loading branch information
catdog2 committed Jun 12, 2024
1 parent 02a552c commit de82481
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Documentation/Helm-Charts/ceph-cluster-chart.gotmpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ The `cephBlockPools` array in the values file will define a list of CephBlockPoo
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephBlockPool | `true` |
| `storageClass.isDefault` | Whether the storage class will be the default storage class for PVCs. See [PersistentVolumeClaim documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) for details. | `true` |
| `storageClass.name` | The name of the storage class | `ceph-block` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.parameters` | See [Block Storage](../Storage-Configuration/Block-Storage-RBD/block-storage.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
| `storageClass.allowVolumeExpansion` | Whether [volume expansion](https://kubernetes.io/docs/concepts/storage/storage-classes/#allow-volume-expansion) is allowed by default. | `true` |
Expand All @@ -96,6 +98,8 @@ The `cephFileSystems` array in the values file will define a list of CephFileSys
| `spec` | The CephFileSystem spec, see the [CephFilesystem CRD](../CRDs/Shared-Filesystem/ceph-filesystem-crd.md) documentation. | see values.yaml |
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephFileSystem | `true` |
| `storageClass.name` | The name of the storage class | `ceph-filesystem` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.pool` | The name of [Data Pool](../CRDs/Shared-Filesystem/ceph-filesystem-crd.md#pools), without the filesystem name prefix | `data0` |
| `storageClass.parameters` | See [Shared Filesystem](../Storage-Configuration/Shared-Filesystem-CephFS/filesystem-storage.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
Expand All @@ -111,6 +115,8 @@ The `cephObjectStores` array in the values file will define a list of CephObject
| `spec` | The CephObjectStore spec, see the [CephObjectStore CRD](../CRDs/Object-Storage/ceph-object-store-crd.md) documentation. | see values.yaml |
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephObjectStore | `true` |
| `storageClass.name` | The name of the storage class | `ceph-bucket` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.parameters` | See [Object Store storage class](../Storage-Configuration/Object-Storage-RGW/ceph-object-bucket-claim.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
| `ingress.enabled` | Enable an ingress for the object store | `false` |
Expand Down
6 changes: 6 additions & 0 deletions Documentation/Helm-Charts/ceph-cluster-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ The `cephBlockPools` array in the values file will define a list of CephBlockPoo
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephBlockPool | `true` |
| `storageClass.isDefault` | Whether the storage class will be the default storage class for PVCs. See [PersistentVolumeClaim documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) for details. | `true` |
| `storageClass.name` | The name of the storage class | `ceph-block` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.parameters` | See [Block Storage](../Storage-Configuration/Block-Storage-RBD/block-storage.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
| `storageClass.allowVolumeExpansion` | Whether [volume expansion](https://kubernetes.io/docs/concepts/storage/storage-classes/#allow-volume-expansion) is allowed by default. | `true` |
Expand All @@ -125,6 +127,8 @@ The `cephFileSystems` array in the values file will define a list of CephFileSys
| `spec` | The CephFileSystem spec, see the [CephFilesystem CRD](../CRDs/Shared-Filesystem/ceph-filesystem-crd.md) documentation. | see values.yaml |
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephFileSystem | `true` |
| `storageClass.name` | The name of the storage class | `ceph-filesystem` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.pool` | The name of [Data Pool](../CRDs/Shared-Filesystem/ceph-filesystem-crd.md#pools), without the filesystem name prefix | `data0` |
| `storageClass.parameters` | See [Shared Filesystem](../Storage-Configuration/Shared-Filesystem-CephFS/filesystem-storage.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
Expand All @@ -140,6 +144,8 @@ The `cephObjectStores` array in the values file will define a list of CephObject
| `spec` | The CephObjectStore spec, see the [CephObjectStore CRD](../CRDs/Object-Storage/ceph-object-store-crd.md) documentation. | see values.yaml |
| `storageClass.enabled` | Whether a storage class is deployed alongside the CephObjectStore | `true` |
| `storageClass.name` | The name of the storage class | `ceph-bucket` |
| `storageClass.annotations` | Additional storage class annotations | `{}` |
| `storageClass.labels` | Additional storage class labels | `{}` |
| `storageClass.parameters` | See [Object Store storage class](../Storage-Configuration/Object-Storage-RGW/ceph-object-bucket-claim.md) documentation or the helm values.yaml for suitable values | see values.yaml |
| `storageClass.reclaimPolicy` | The default [Reclaim Policy](https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy) to apply to PVCs created with this storage class. | `Delete` |
| `ingress.enabled` | Enable an ingress for the object store | `false` |
Expand Down
7 changes: 7 additions & 0 deletions deploy/charts/rook-ceph-cluster/templates/cephblockpool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ $blockpool.storageClass.name }}
{{- if $blockpool.storageClass.labels }}
labels:
{{ toYaml $blockpool.storageClass.labels | indent 4 }}
{{- end }}
annotations:
storageclass.kubernetes.io/is-default-class: "{{ if default false $blockpool.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $blockpool.storageClass.annotations }}
{{ toYaml $blockpool.storageClass.annotations | indent 4 }}
{{- end }}
{{- if $root.Values.csiDriverNamePrefix }}
provisioner: {{ $root.Values.csiDriverNamePrefix }}.rbd.csi.ceph.com
{{- else }}
Expand Down
12 changes: 9 additions & 3 deletions deploy/charts/rook-ceph-cluster/templates/cephecblockpool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ $ecblockpool.storageClass.name }}
{{- if $ecblockpool.storageClass.isDefault }}
{{- if $ecblockpool.storageClass.labels }}
labels:
{{ toYaml $ecblockpool.storageClass.labels | indent 4 }}
{{- end }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{end}}
storageclass.kubernetes.io/is-default-class: "{{ if default false $ecblockpool.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $ecblockpool.storageClass.annotations }}
{{ toYaml $ecblockpool.storageClass.annotations | indent 4 }}
{{- end }}

{{- if $root.Values.csiDriverNamePrefix }}
provisioner: {{ $root.Values.csiDriverNamePrefix }}.rbd.csi.ceph.com
{{- else }}
Expand Down
7 changes: 7 additions & 0 deletions deploy/charts/rook-ceph-cluster/templates/cephfilesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ $filesystem.storageClass.name }}
{{- if $filesystem.storageClass.labels }}
labels:
{{ toYaml $filesystem.storageClass.labels | indent 4 }}
{{- end }}
annotations:
storageclass.kubernetes.io/is-default-class: "{{ if default false $filesystem.storageClass.isDefault }}true{{ else }}false{{ end }}"
{{- if $filesystem.storageClass.annotations }}
{{ toYaml $filesystem.storageClass.annotations | indent 4 }}
{{- end }}
{{- if $root.Values.csiDriverNamePrefix }}
provisioner: {{ $root.Values.csiDriverNamePrefix }}.cephfs.csi.ceph.com
{{- else }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ $objectstore.storageClass.name }}
{{- if $objectstore.storageClass.labels }}
labels:
{{ toYaml $objectstore.storageClass.labels | indent 4 }}
{{- end }}
{{- if $objectstore.storageClass.annotations }}
annotations:
{{ toYaml $objectstore.storageClass.annotations | indent 4 }}
{{- end }}
provisioner: {{ $root.Release.Namespace }}.ceph.rook.io/bucket
reclaimPolicy: {{ default "Delete" $objectstore.storageClass.reclaimPolicy }}
volumeBindingMode: {{ default "Immediate" $objectstore.storageClass.volumeBindingMode }}
Expand Down
10 changes: 9 additions & 1 deletion deploy/charts/rook-ceph-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ cephBlockPools:
storageClass:
enabled: true
name: ceph-block
annotations: { }
labels: { }
isDefault: true
reclaimPolicy: Delete
allowVolumeExpansion: true
Expand Down Expand Up @@ -534,6 +536,8 @@ cephFileSystems:
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: "Immediate"
annotations: { }
labels: { }
mountOptions: []
# see https://github.com/rook/rook/blob/master/Documentation/Storage-Configuration/Shared-Filesystem-CephFS/filesystem-storage.md#provision-storage for available configuration
parameters:
Expand Down Expand Up @@ -606,6 +610,8 @@ cephObjectStores:
name: ceph-bucket
reclaimPolicy: Delete
volumeBindingMode: "Immediate"
annotations: { }
labels: { }
# see https://github.com/rook/rook/blob/master/Documentation/Storage-Configuration/Object-Storage-RGW/ceph-object-bucket-claim.md#storageclass for available configuration
parameters:
# note: objectStoreNamespace and objectStoreName are configured by the chart
Expand Down Expand Up @@ -669,8 +675,10 @@ cephObjectStores:
# storageClass:
# provisioner: rook-ceph.rbd.csi.ceph.com # csi-provisioner-name
# enabled: true
# name: rook-ceph-block
# name: rook-ceph-block
# isDefault: false
# annotations: { }
# labels: { }
# allowVolumeExpansion: true
# reclaimPolicy: Delete

Expand Down

0 comments on commit de82481

Please sign in to comment.