local-path-provisioner icon indicating copy to clipboard operation
local-path-provisioner copied to clipboard

Support for shared filesystems

Open dchirikov opened this issue 3 years ago • 17 comments

Instead of spamming in #174 I will create another PR.

This is an attempt to bring shared file systems support.

sharedFileSystemPath allows the provisioner to use a filesystem that is mounted on all nodes at the same time. In this case all access modes are supported: ReadWriteOnce, ReadOnlyMany and ReadWriteMany for storage claims.

In addition volumeBindingMode: Immediate can be used in StorageClass definition.

Please note that nodePathMap and sharedFileSystemPath are mutually exclusive. If sharedFileSystemPath is used, then nodePathMap must be set to [].

dchirikov avatar Mar 12 '21 14:03 dchirikov

@innobead any idea if something like this could land?

weisjohn avatar Sep 18 '21 02:09 weisjohn

Would love to see this included as well. Support for shared filesystem hostPath would be amazing especially for reusing existing shared file system environments that do not have a csi or ability to retool just yet.

weishiuchang avatar Oct 02 '21 00:10 weishiuchang

Hate to bump, but we would also love if this could land - would remove a huge amount of complexity on our side. Are there any known blockers @dchirikov?

erulabs avatar Nov 13 '21 20:11 erulabs

@erulabs I can not merge in this repo. So it's all up to the owner. I can only say there is literally zero comments from rancher team, so not sure if it ever will be merged. Also I would like to have solved #182 too, because it's typical in our setups have shared FS and unprivileged users having local/ssh access to the nodes.

dchirikov avatar Nov 13 '21 21:11 dchirikov

Can we merge dchirikov's solution? It would be very useful.

gabbler97 avatar Nov 26 '21 09:11 gabbler97

@dchirikov Could you please resolve the conflict first? I will review it after resolving the conflict. Thanks.

derekbit avatar Dec 21 '21 16:12 derekbit

@derekbit I will. Sorry pretty busy atm, give me couple of weeks, please.

dchirikov avatar Dec 22 '21 13:12 dchirikov

@dchirikov Sure thing. Take your time.

derekbit avatar Dec 22 '21 15:12 derekbit

@derekbit Happy new year! I rebased my PR, please check.

dchirikov avatar Jan 03 '22 15:01 dchirikov

Thanks! If anyone wants to try it, I've bundled the changes in a container at ghcr.io/fastlorenzo/local-path-provisioner:5888a9b-amd64

After creating a new cluster with k3d, you can run the following:

kubectl create configmap local-path-config --from-file config.json -n kube-system -o yaml --dry-run | kubectl apply -f -
kubectl -n kube-system get deployments.apps local-path-provisioner -o yaml | sed 's/image: .*local-path-provisioner.*$/image: ghcr.io\/fastlorenzo\/local-path-provisioner:5888a9b-amd64/g' | kubectl apply -f -

Where the content of config.json is:

{
    "sharedFileSystemPath": "/var/lib/rancher/k3s/storage",
    "nodePathMap": []
}

This will update the config of the local-path-provisioner deployment and switch the image to the version containing the support for shared file system \o/

So far, so good, didn't notice any issue yet (as long as you use ReadWriteMany mode, but this is expected). If I stop one of the node, it correctly switches the pod to another node without re-creating a new volume.

fastlorenzo avatar Jan 04 '22 01:01 fastlorenzo

@derekbit do you have a timeline for this PR?

dfoxg avatar Feb 02 '22 09:02 dfoxg

@dchirikov for a quick win, would it be enough to remove the nodeAffinity on already created pv´s?

EDIT: nope didn´t work, field is immutable :(

dfoxg avatar Feb 02 '22 15:02 dfoxg

Is there a viable alternative? Anything that can be just installed as extra storage class by any chance?

dimon222 avatar Feb 04 '22 18:02 dimon222

This branch works for me. I have a GFS2 cluster on the k8s nodes and ReadWriteMany is very suitable for that. For example, to enable single-instance database such as MySQL to not be "pinned" to single node. Of course you have to be careful to avoid corrupting the database when failing-over an instance from one node to another as k8s does not "fence" one instance from another, but databases usually contain an option that prevents such concurrent access or coordinates it from multiple instances (external locking for MySQL for example). It would be nice to integrate this to main. Are there any reservations? Potential problems?

plevart avatar Jun 16 '22 07:06 plevart

Hey guys. Any chance this PR will be merged? It being open for more than a year already.

dchirikov avatar Jul 22 '22 14:07 dchirikov

@dchirikov perhaps, If you could rebase it to master (it currently has conflicts), it would be easier for maintainers to merge it. I too am interested for this to get merged. Currently I use your branch, but master has progressed and new versions were released in the meantime...

plevart avatar Jul 26 '22 12:07 plevart

Hey guys. Any chance this PR will be merged? It being open for more than a year already.

Yeah, I will review again and merge it after rebase. Thank you.

derekbit avatar Jul 26 '22 13:07 derekbit

Hi @derekbit are there any updates?

dfoxg avatar Sep 17 '22 07:09 dfoxg

@dfoxg
Sorry for the late review. I will finish the review by next Friday.

derekbit avatar Sep 17 '22 09:09 derekbit

@dchirikov In general, LGTM. Could you please add an example (examples). A test (examples) is also appreciated.

derekbit avatar Sep 24 '22 11:09 derekbit

@derekbit Hi there! I resolved conflicts and added example. Please have a look.

dchirikov avatar Sep 28 '22 21:09 dchirikov

Hi, really interested in seeing this being merged, but I was testing the Helm chart and I think that the following file was forgotten!

https://github.com/dchirikov/local-path-provisioner/blob/shared_fs/deploy/chart/local-path-provisioner/templates/configmap.yaml#L10

And thanks for the work @dchirikov!

Vinrobot avatar Oct 06 '22 23:10 Vinrobot