purestorage / helm-charts

Pure Storage Helm Charts
Apache License 2.0
47 stars 43 forks source link

[pure-csi] create pvc from an externally created snapshots #189

Closed javefang closed 4 years ago

javefang commented 4 years ago

Hello,

In the old flexvolume plugin we used to be able to create PVC from a snapshot via annotation snapshot.beta.purestorage.com/name: <snapshot_name>. It doens't care how the snapshot was created as long as the prefix matches. We have been trying the new pure-csi plugin now and this annotation seems to cease to work.

We have an application in k8s which consumes snapshots outside of the k8s cluster (name <prefix>-<id> so it can be used in the k8s cluster). This used to work with the snapshot annotation. But I can't seem to find a way to do it the "CSI-way" after reading https://github.com/purestorage/helm-charts/blob/master/docs/csi-snapshot-clones.md

Any help is appreciated :)

Thanks Xinghong

sdodsley commented 4 years ago

What you are talking about is effectively volume import. This is not defined in the CSI spec, hence why we can't do it at the moment. We are working on volume import currently and should have it as a feature in the next quarter. TBH import was only supposed to be for full volumes, not externally created snapshots, but I suspect we could look at how they could be consumed as well.

javefang commented 4 years ago

not exactly volume import, I'm still creating a volume from a snapshot, it's just that the snapshot was created externally, with the name set to the same prefix so it can be accepted by the pure-k8s-plugin.

sdodsley commented 4 years ago

I understand what you are saying but the CSI spec would treat this as a volume import because the snapshot name (even with the correct naming convention) is not known by k8s and therefore is treated as an external volume. That means import.

javefang commented 4 years ago

understood. is it possible to install both pure-k8s-plugin (flexvol) and pure-csi on the same cluster? (as different StorageClass)

sdodsley commented 4 years ago

I think it will work (I gave it a quick try), but you will have to clone the flex repo, edit the storageclass.yaml template file to use different names and then zip this up into a tarball for helm to use locally. Your values.yaml for flex will need a different service account name, eg pure-flex and I would suggest a different pure namespace setting so you can identify which driver created the volumes on the backing arrays. You will also have to install the flex driver in a separate namespace to the CSI driver or there will be clashes with secrets and daemonset names, etc So, final warning - THIS IS NOT AN APPROVED OR SUPPORTED CONFIGURATION Also, remember you cannot migrate from flex to csi.... If you do try this I'd love to know if you were successful.

javefang commented 4 years ago

Thanks for the explanation :) looking forward to the volume import feature!

sdodsley commented 4 years ago

@javefang Volume Import is supported from PSO CSI driver v5.2.0. It can't (yet) do direct import from snapshots, but you can automate that today whilst we investigate how that would be possible under the CSI spec.

javefang commented 4 years ago

Awesome! volume import would be even better for our use case! looking forward to the release

sdodsley commented 4 years ago

@javefang 5.2.0 has just released: https://github.com/purestorage/helm-charts/releases/tag/5.2.0