hpe-storage / dory

Kubernetes Flexvolume Driver for Docker Volume Plugins
Apache License 2.0
28 stars 10 forks source link

Can I set the reclaimPolicy in Storageclass?? #39

Closed doziya closed 6 years ago

doziya commented 6 years ago

Hi all. I am one TC of Korea HPE Pointnext. I did the K8S with 3PAR POC a few days ago. However, I could not change the reclaim policy in the Storageclass.

Does not dory originally support it?

Below are my configuration.

thin_sc.yml


kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: thin provisioner: dev.hpe.com/hpe reclaimPolicy: "Retain" parameters: provisioning: "thin"

pvc.yml


kind: PersistentVolumeClaim apiVersion: v1 metadata: name: thin-pvc spec: accessModes:

Result

NAME PROVISIONER storageclasses/thin dev.hpe.com/hpe

NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pv/thin-0289be6d-72d7-11e8-a9fc-ecebb896add8 16Gi RWO Delete Bound default/thin-pvc thin 2s

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE pvc/thin-pvc Bound thin-0289be6d-72d7-11e8-a9fc-ecebb896add8 16Gi RWO thin 2s

datamattsson commented 6 years ago

Setting the reclaimPolicy in the StorageClass is part of K8s functionality. In newer versions of K8s you should be able to set reclaimPolicy: Retain in the base of the StorageClass object. In some newer distributions of K8s I've seen that Retain is the default. If it doesn't work you can always change the policy on the PV itself:

kubectl patch pv/myvol1 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
doziya commented 6 years ago

Thanks for your reply.

But I already tried applying it with the patch option.

What my customers want is to apply policy from the creation of the storageclass yml file.

However, I created sc using the yml file with the reclaimPolicy: "Retain" option, and then created pvc. but it did not work.

e4jet commented 6 years ago

Hi @doziya - thanks for raising this issue. You are correct, the reclaimPolicy in the storage class is being ignored when the pv is created (resulting in the default being specified). We'll get this addressed.

datamattsson commented 6 years ago

Thanks for clarifying @e4jet. I didn't realize that the provisioner was responsible for this.

doziya commented 6 years ago

Thank you all for your reply. Can I ask you one more question?

And the File system mount option (like the discard option) does not seem to work either.

For environments with thin provisioning volumes, this is an essential option for efficient capacity management.

It would be nice to have other options available, including the discard option.

I really appreciate your reply.

e4jet commented 6 years ago

And the File system mount option (like the discard option) does not seem to work either.

This is challenging because the flexvolume driver doesn't support this. We'll be able to support this when we change to the CSI back-end (edging closer to GA in k8s).

doziya commented 6 years ago

Thanks @e4jet. Your answers were very helpful. If I have another issue, Can I ask you a question in here?

e4jet commented 6 years ago

Sure @doziya or feel free to ping me via email at eric.forgette [at sign] hpe.com. I'm also on hpe.slack.com and kubernetes.slack.com

e4jet commented 6 years ago

Pull request #41 should address this once merged.

e4jet commented 6 years ago

this is available in nimblestorage/kube-storage-controller:edge as of now

abhishekk8s commented 2 years ago

Since, the reclaim policy is integral part of back-end storage being provisioned, so it can be edited and we get below error. "# * reclaimPolicy: Forbidden: updates to reclaimPolicy are forbidden." However the "reclaimPolicy" can be configured at the time of storage Class creation. then the "Retain" policy is allowed and SC is successfully created with Retain.

e4jet commented 2 years ago

Sorry, this project has been deprecated. Please have a look at the CSI driver - https://github.com/hpe-storage/csi-driver