Why custom volume name for dynamically provisioned PVs? I asked the same question to community users who requested this feature and the answer was, it helps a lot to filter the gluster volume names which are serving as persistent volumes. True, if there are any number of volumes say ~1000 volumes in your cluster figuring out which volume belongs to which storage class or which project or PVC ..etc seems extremely difficult. The grouping of volume names is required for different use cases or maintenance activities.
The custom volume name support for GlusterFS PVs helps to filter glusterfs volumes which are serving persistent storage for application pods in kubernetes/openshift based on any of the below:
*) “Any string” you have given in GlusterFS Storage Class Yaml for attribute called “volumenameprefix”.
*) Based on “PVC” name
*) Based on “NAMESPACE/PROJECT” name in your kubernetes/Openshift Cluster
Once this feature is enabled, gluster volumes are provisioned in below format:
volumenameprefix_namespace_pvcname_uuid
volumenameprefix can be “ANY” string you want , it can be “storageclass name” or any string like “dept-dev”, “cns-gold” or anything!
Demo :
Even though its pretty clear from demo how this can be used, I am providing the snips here:
Create a storage class, the interesting or new field here is volumenameprefix: “dept-dev”
Then create a PVC that points to the above storage class (fast).
[root@localhost cluster]# kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE claim1 Bound pvc-1605d381-0b68-11e8-a4ba-c85b7636c232 8Gi RWX fast 1m [root@localhost cluster]#
[root@localhost cluster]# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-1605d381-0b68-11e8-a4ba-c85b7636c232 8Gi RWX Delete Bound default/claim1 fast 4s [root@localhost cluster]#
Get more details about the PV:
Here dept-dev_default_claim1_1606d85e-0b68-11e8-9b7a-c85b7636c232 is the gluster volume name.
dept-dev : string given in storage class
default : namespace name
claim1 : PVC name
Lets delete this PV:
[root@localhost cluster]# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-1605d381-0b68-11e8-a4ba-c85b7636c232 8Gi RWX Delete Released default/claim1 fast 1m [root@localhost cluster]# kubectl get pv No resources found. [root@localhost cluster]#
Any feedback/suggestions/comments?