ceph / ceph-csi

CSI driver for Ceph
Apache License 2.0
1.19k stars 527 forks source link

Support storing cephfs omap in a different namespace in rados under same filesystem metadata pool #4652

Open zerotens opened 1 month ago

zerotens commented 1 month ago

Describe what this PR does

Fixes #4599

This PR adds a new cli argument to let users override the current hardcoded radosNamespace "csi" used in CephFS. https://github.com/ceph/ceph-csi/blob/ce3ec6acbf639f9485ba63220329d07407713fa1/internal/cephfs/util/util.go#L24 Needed is this for multitenant environments where one ceph cluster with one cephfs filesystem is used by multiple kubernetes clusters. This allows storing the state of every cephfs instance / kubernetes cluster in their own radosNamespaces and allows finer controlled access for cephfs.

This PR also makes those two needed parameters --instanceid (rbd & cephfs Helm Chart) and --radosnamespacecephfs (cephfs Helm Chart) configurable via helm chart.

Is there anything that requires special attention

Is the change backward compatible?

Yes

Are there concerns around backward compatibility?

No, the default values in code have not been changed but are now overrideable via helm and cli arguments.

Future concerns

Depending on future usage of the NFS Controller, currently the NFS controller is using the CephFS variables cephfs.CSIInstanceID and fsutil.RadosNamespace which is now overrideable with the cli argument --radosnamespacecephfs and --instanceid. https://github.com/ceph/ceph-csi/blob/ce3ec6acbf639f9485ba63220329d07407713fa1/internal/nfs/controller/controllerserver.go#L48 https://github.com/ceph/ceph-csi/blob/ce3ec6acbf639f9485ba63220329d07407713fa1/internal/nfs/controller/controllerserver.go#L49 https://github.com/ceph/ceph-csi/blob/ce3ec6acbf639f9485ba63220329d07407713fa1/internal/nfs/controller/volume.go#L291 https://github.com/ceph/ceph-csi/blob/ce3ec6acbf639f9485ba63220329d07407713fa1/internal/nfs/controller/volume.go#L329

Testing

As i don't have a nice way of testing it and this is my first PR and go code for some time i would appreciate an detailed review.

zerotens commented 4 weeks ago

@nixpanic Linting was hopefully fixed /retest please