Skip to content

Commit f1848cd

Browse files
authored
[manila-csi-plugin] Add options for passing mount opts to cephfs-csi (kubernetes#1605)
* added cephfs-csi mount opts to volume context This commit adds two new options specific to cephfs-csi to ControllerVolumeContext and NodeVolumeContext: * cephfs-kernelMountOptions, * cephfs-fuseMountOptions * pass cephfs-kernelMountOptions and cephfs-fuseMountOptions to cephfs-csi * updated docs with new volume context opts
1 parent 30ebb99 commit f1848cd

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

docs/manila-csi-plugin/using-manila-csi-plugin.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Parameter | Required | Description
5050
`availability` | _no_ | Manila availability zone of the provisioned share. If none is provided, the default Manila zone will be used. Note that this parameter is opaque to the CO and does not influence placement of workloads that will consume this share, meaning they may be scheduled onto any node of the cluster. If the specified Manila AZ is not equally accessible from all compute nodes of the cluster, use [Topology-aware dynamic provisioning](#topology-aware-dynamic-provisioning).
5151
`appendShareMetadata` | _no_ | Append user-defined metadata to the provisioned share. If not empty, this field must be a string with a valid JSON object. The object must consist of key-value pairs of type string. Example: `"{..., \"key\": \"value\"}"`.
5252
`cephfs-mounter` | _no_ | Relevant for CephFS Manila shares. Specifies which mounting method to use with the CSI CephFS driver. Available options are `kernel` and `fuse`, defaults to `fuse`. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
53+
`cephfs-kernelMountOptions` | _no_ | Relevant for CephFS Manila shares. Specifies mount options for CephFS kernel client. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
54+
`cephfs-fuseMountOptions` | _no_ | Relevant for CephFS Manila shares. Specifies mount options for CephFS FUSE client. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
5355
`cephfs-clientID` | _no_ | Relevant for CephFS Manila shares. Specifies the cephx client ID when creating an access rule for the provisioned share. The same cephx client ID may be shared with multiple Manila shares. If no value is provided, client ID for the provisioned Manila share will be set to some unique value (PersistentVolume name).
5456
`nfs-shareClient` | _no_ | Relevant for NFS Manila shares. Specifies what address has access to the NFS share. Defaults to `0.0.0.0/0`, i.e. anyone.
5557

@@ -63,6 +65,8 @@ Parameter | Required | Description
6365
`shareName` | if `shareID` is not given | The name of the share
6466
`shareAccessID` | _yes_ | The UUID of the access rule for the share
6567
`cephfs-mounter` | _no_ | Relevant for CephFS Manila shares. Specifies which mounting method to use with the CSI CephFS driver. Available options are `kernel` and `fuse`, defaults to `fuse`. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
68+
`cephfs-kernelMountOptions` | _no_ | Relevant for CephFS Manila shares. Specifies mount options for CephFS kernel client. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
69+
`cephfs-fuseMountOptions` | _no_ | Relevant for CephFS Manila shares. Specifies mount options for CephFS FUSE client. See [CSI CephFS docs](https://github.com/ceph/ceph-csi/blob/csi-v1.0/docs/deploy-cephfs.md#configuration) for further information.
6670

6771
_Note that the Node Plugin of CSI Manila doesn't care about the origin of a share. As long as the share protocol is supported, CSI Manila is able to consume dynamically provisioned as well as pre-provisioned shares (e.g. shares created manually)._
6872

pkg/csi/manila/options/shareoptions.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ type ControllerVolumeContext struct {
2929

3030
// Adapter options
3131

32-
CephfsMounter string `name:"cephfs-mounter" value:"default:fuse" matches:"^kernel|fuse$"`
33-
CephfsClientID string `name:"cephfs-clientID" value:"optional"`
34-
NFSShareClient string `name:"nfs-shareClient" value:"default:0.0.0.0/0"`
32+
CephfsMounter string `name:"cephfs-mounter" value:"default:fuse" matches:"^kernel|fuse$"`
33+
CephfsClientID string `name:"cephfs-clientID" value:"optional"`
34+
CephfsKernelMountOptions string `name:"cephfs-kernelMountOptions" value:"optional"`
35+
CephfsFuseMountOptions string `name:"cephfs-fuseMountOptions" value:"optional"`
36+
NFSShareClient string `name:"nfs-shareClient" value:"default:0.0.0.0/0"`
3537
}
3638

3739
type NodeVolumeContext struct {
@@ -41,7 +43,9 @@ type NodeVolumeContext struct {
4143

4244
// Adapter options
4345

44-
CephfsMounter string `name:"cephfs-mounter" value:"default:fuse" matches:"^kernel|fuse$"`
46+
CephfsMounter string `name:"cephfs-mounter" value:"default:fuse" matches:"^kernel|fuse$"`
47+
CephfsKernelMountOptions string `name:"cephfs-kernelMountOptions" value:"optional"`
48+
CephfsFuseMountOptions string `name:"cephfs-fuseMountOptions" value:"optional"`
4549
}
4650

4751
var (

pkg/csi/manila/shareadapters/cephfs.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,22 @@ func (Cephfs) BuildVolumeContext(args *VolumeContextArgs) (volumeContext map[str
117117

118118
monitors, rootPath, err := splitExportLocationPath(args.Locations[chosenExportLocationIdx].Path)
119119

120-
return map[string]string{
120+
volCtx := map[string]string{
121121
"monitors": monitors,
122122
"rootPath": rootPath,
123123
"mounter": args.Options.CephfsMounter,
124124
"provisionVolume": "false",
125-
}, err
125+
}
126+
127+
if args.Options.CephfsKernelMountOptions != "" {
128+
volCtx["kernelMountOptions"] = args.Options.CephfsKernelMountOptions
129+
}
130+
131+
if args.Options.CephfsFuseMountOptions != "" {
132+
volCtx["fuseMountOptions"] = args.Options.CephfsFuseMountOptions
133+
}
134+
135+
return volCtx, err
126136
}
127137

128138
func (Cephfs) BuildNodeStageSecret(args *SecretArgs) (secret map[string]string, err error) {

0 commit comments

Comments
 (0)