[ceph] Add support to create storageclasses

This is to  add support for creating storageclasses for pv/pvc.
  - block-storage-sc
  - cephfs-storage-sc

Change-Id: I30471d8d6515a22bcf7c9628c804e6c72191be7a
This commit is contained in:
Chinasubbareddy Mallavarapu 2021-05-04 19:56:40 +00:00 committed by chinasubbareddy mallavarapu
parent 2d035c8e3c
commit 862dfd6e74
8 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,55 @@
##################################################
# Create storaclass for pv/pvc creation
# make sure pool is getting create prior to this
# kubectl create -f storageclass.yaml
##################################################
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storage-sc
# Change "rook-ceph" provisioner prefix to match the operator namespace if needed
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
# clusterID is the namespace where the rook cluster is running
clusterID: rook-ceph
# Ceph pool into which the RBD image shall be created
pool: pool1
# (optional) mapOptions is a comma-separated list of map options.
# For krbd options refer
# https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options
# For nbd options refer
# https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options
# mapOptions: lock_on_read,queue_depth=1024
# (optional) unmapOptions is a comma-separated list of unmap options.
# For krbd options refer
# https://docs.ceph.com/docs/master/man/8/rbd/#kernel-rbd-krbd-options
# For nbd options refer
# https://docs.ceph.com/docs/master/man/8/rbd-nbd/#options
# unmapOptions: force
# RBD image format. Defaults to "2".
imageFormat: "2"
# RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
imageFeatures: layering
# The secrets contain Ceph admin credentials.
csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
# Specify the filesystem type of the volume. If not specified, csi-provisioner
# will set default as `ext4`. Note that `xfs` is not recommended due to potential deadlock
# in hyperconverged settings where the volume is mounted on the same node as the osds.
csi.storage.k8s.io/fstype: ext4
# allow pvc resize
allowVolumeExpansion: true
# Delete the rbd volume when a PVC is deleted
reclaimPolicy: Delete

View File

@ -0,0 +1,5 @@
resources:
- block-storageclass.yaml
namePrefix: block-
patchesStrategicMerge:
- patches/rook-ceph-block.yaml

View File

@ -0,0 +1,18 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storage-sc
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
pool: rbd-pool
imageFormat: "2"
imageFeatures: layering
csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
csi.storage.k8s.io/fstype: ext4
reclaimPolicy: Delete

View File

@ -0,0 +1,40 @@
##################################################
# Create storaclass for pv/pvc creation
# make sure pool is getting create prior to this
# kubectl create -f storageclass.yaml
##################################################
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storage-sc
provisioner: rook-ceph.cephfs.csi.ceph.com # driver:namespace:operator
parameters:
# clusterID is the namespace where operator is deployed.
clusterID: rook-ceph # namespace:cluster
# CephFS filesystem name into which the volume shall be created
fsName: cephfs
# Ceph pool into which the volume shall be created
# Required for provisionVolume: "true"
pool: cephfs-data0
# The secrets contain Ceph admin credentials. These are generated automatically by the operator
# in the same namespace as the cluster.
csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph # namespace:cluster
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph # namespace:cluster
csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph # namespace:cluster
# (optional) The driver can use either ceph-fuse (fuse) or ceph kernel client (kernel)
# If omitted, default volume mounter will be used - this is determined by probing for ceph-fuse
# or by setting the default mounter explicitly via --volumemounter command-line argument.
# mounter: kernel
reclaimPolicy: Delete
allowVolumeExpansion: true
mountOptions:
# uncomment the following line for debugging
#- debug

View File

@ -0,0 +1,5 @@
resources:
- file-storageclass.yaml
namePrefix: cephfs-
patchesStrategicMerge:
- patches/rook-ceph-cephfs.yaml

View File

@ -0,0 +1,15 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storage-sc
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
clusterID: rook-ceph
fsName: cephfs
pool: cephfs-data0
csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/controller-expand-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph

View File

@ -0,0 +1,3 @@
resources:
- block
- file

View File

@ -13,6 +13,7 @@ resources:
- ../../../../../../function/rook-cluster/pools
- ../../../../../../function/rook-cluster/cephfs
- ../../../../../../function/rook-cluster/dashboard/http
- ../../../../../../function/rook-cluster/storageclasses
patchesJSON6902:
- target:
kind: CephCluster