olljanat / csi-plugins-for-docker-swarm

MIT License
46 stars 8 forks source link

Add fs_type to docker volume create call #7

Open s4ke opened 1 year ago

s4ke commented 1 year ago

something I have not managed to do on the command line (haven't tried stack files yet) is specifying the fs_type properly so that it is forwarded to the csi driver.

I have not seen any documentation on this, so I am a bit failing forward.

I tried:

docker volume create   --driver hetznercloud/hcloud-csi-driver:dev-swarm --required-bytes 50G  --type mount   --sharing all --scope single hcloud-new-debug-xfs2 --topology-required nbg1 --opt fs_type:xfs

and

docker volume create   --driver hetznercloud/hcloud-csi-driver:dev-swarm --required-bytes 50G  --type mount   --sharing all --scope single hcloud-new-debug-xfs2 --topology-required nbg1 --opt fs_type=xfs
olljanat commented 1 year ago

Second look other way correct but volume name need to be last parameter.

Look my NFS example https://github.com/olljanat/csi-plugins-for-docker-swarm/tree/master/csi-driver-nfs#usage and their K8s guide https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/deploy/example/README.md#storage-class-usage-dynamic-provisioning

Same way you need find options/parameters which this driver reads.

s4ke commented 1 year ago

Hmm, still does not seem to work (haven't checked the handling in the plugin), but this seems to be part of the CSI spec directly and not a specific thing of the plugin, see https://github.com/moby/swarmkit/blob/b1aac88ed7cd28b6a12c12ad4c2a9cc1d423d3bb/agent/csi/plugin/plugin.go#L437

See https://github.com/docker/cli/blob/3dfef7691ec8123bc77855fe640d940bcbee568d/cli/compose/schema/data/config_schema_v3.10.json#L540 for the compose json and https://github.com/docker/cli/blob/099c5e7415b2dfe538f13eb05784a53e51f42b57/cli/compose/types/types.go#L516 for the option.

Could it be that this is only supported in stack files?

olljanat commented 1 year ago

I didn't got stack file fully working at all (which why it is renamed). However I'm quite sure that you cannot use generic options like that fs_type here because those most likely only works with Docker local volume driver.

Instead of you need use options which are supported by CSI driver. NFS driver example did fail from starting with error which said that server parameter is mandatory.

s4ke commented 1 year ago

I checked the plumbing and from what I understand this fs_type setting was added together with CSI support (see the linked files), am I missing something?

olljanat commented 1 year ago

ah, so those are most probably mount flags like tmpfs-mode on example in here https://docs.docker.com/storage/tmpfs/#specify-tmpfs-options