-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CephFS: kernel and fuse mount options per cluster #4245
CephFS: kernel and fuse mount options per cluster #4245
Conversation
12538e0
to
9a66115
Compare
9a66115
to
a43e630
Compare
internal/cephfs/nodeserver.go
Outdated
|
||
switch mnt.(type) { | ||
case *mounter.FuseMounter: | ||
getMountOptionsFunc = util.GetCephFSFuseMountOptions | ||
CLIMountOptions = ns.fuseMountOptions | ||
case *mounter.KernelMounter: | ||
getMountOptionsFunc = util.GetCephFSKernelMountOptions | ||
CLIMountOptions = ns.kernelMountOptions | ||
} | ||
|
||
mountOptions, err := getMountOptionsFunc(util.CsiConfigFile, volOptions.ClusterID) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
if mountOptions != "" { | ||
return mountOptions, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single function to fetch both kernel and fuse mount options and later decide which one to pass.
switch mnt.(type) { | |
case *mounter.FuseMounter: | |
getMountOptionsFunc = util.GetCephFSFuseMountOptions | |
CLIMountOptions = ns.fuseMountOptions | |
case *mounter.KernelMounter: | |
getMountOptionsFunc = util.GetCephFSKernelMountOptions | |
CLIMountOptions = ns.kernelMountOptions | |
} | |
mountOptions, err := getMountOptionsFunc(util.CsiConfigFile, volOptions.ClusterID) | |
if err != nil { | |
return "", err | |
} | |
if mountOptions != "" { | |
return mountOptions, nil | |
} | |
kernelMountOptions, fuseMountOptions, err := getMountOptions(util.CsiConfigFile, volOptions.ClusterID) | |
if err != nil { | |
return "", err | |
} | |
case *mounter.FuseMounter: | |
mountOptions = fuseMountOptions | |
CLIMountOptions = ns.fuseMountOptions | |
case *mounter.KernelMounter: | |
mountOptions = kernelMountOptions | |
CLIMountOptions = ns.kernelMountOptions | |
} | |
if mountOptions != "" { | |
return mountOptions, nil | |
} |
internal/cephfs/nodeserver.go
Outdated
@@ -316,12 +316,19 @@ func (ns *NodeServer) mount( | |||
mountOptions = m.GetMountFlags() | |||
} | |||
|
|||
mntOptions, err := ns.getMountOptions(mnt, volOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe name it configuredMountOptions or something and add a label where these options come from ?
internal/cephfs/nodeserver.go
Outdated
@@ -316,12 +316,19 @@ func (ns *NodeServer) mount( | |||
mountOptions = m.GetMountFlags() | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its better to move the entire flow to obtain mountOptions from line 314 above to a helper function + unit tests.
7457046
to
e22b23f
Compare
This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏 |
e22b23f
to
3fafd2e
Compare
internal/util/csiconfig.go
Outdated
@@ -48,6 +48,10 @@ type ClusterInfo struct { | |||
NetNamespaceFilePath string `json:"netNamespaceFilePath"` | |||
// SubvolumeGroup contains the name of the SubvolumeGroup for CSI volumes | |||
SubvolumeGroup string `json:"subvolumeGroup"` | |||
// KernelMountOptions contains the kernel mount options for CephFS volumes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract the entire CephFS struct into a independent type.
That should help writing unit test cases instead of defining the type each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
KernelMountOptions string `json:"kernelMountOptions"` | ||
FuseMountOptions string `json:"fuseMountOptions"` | ||
}{ | ||
KernelMountOptions: "crc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention the input along the output in the same struct or create a sub struct for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We require the separate definition of 'csiConfig' input since it will be written to a file. It will be complex to combine both input and output together.
internal/cephfs/nodeserver.go
Outdated
if m := volCap.GetMount(); m != nil { | ||
mountOptions = m.GetMountFlags() | ||
} | ||
err = ns.getMountOptions(mnt, volOptions, volCap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setMountOptions is better suited.
Please include the below "ro" detection in the function too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
3fafd2e
to
5367aaa
Compare
fbda7a8
to
59da859
Compare
/test ci/centos/mini-e2e/k8s-1.28 |
59da859
to
a56a8b7
Compare
a56a8b7
to
4c6063f
Compare
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, can you please check that we don't have any problem for the static PVC where clusterID might not be set but monitor IP's are passed?
4c6063f
to
35ca751
Compare
Added a check for empty ClusterID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Mergifyio rebase |
This commit adds GetCephFSMountOptions util method which returns KernelMountOptions and fuseMountOptions for cluster `clusterID`. Signed-off-by: Praveen M <m.praveen@ibm.com>
Implemented the capability to include kernel mount options and fuse mount options for individual clusters within the ceph-csi-config ConfigMap.This allows users to configure the kernel/fuse mount options for each cluster separately. The mount options specified in the ConfigMap will supersede those provided via command line arguments. Signed-off-by: Praveen M <m.praveen@ibm.com>
Signed-off-by: Praveen M <m.praveen@ibm.com>
✅ Branch has been successfully rebased |
35ca751
to
3e60a29
Compare
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 4ee466b |
/test ci/centos/k8s-e2e-external-storage/1.27 |
/test ci/centos/k8s-e2e-external-storage/1.28 |
/test ci/centos/upgrade-tests-cephfs |
/test ci/centos/k8s-e2e-external-storage/1.26 |
/test ci/centos/mini-e2e-helm/k8s-1.28 |
/test ci/centos/upgrade-tests-rbd |
/test ci/centos/mini-e2e-helm/k8s-1.26 |
/test ci/centos/mini-e2e/k8s-1.28 |
/test ci/centos/mini-e2e-helm/k8s-1.27 |
/test ci/centos/mini-e2e/k8s-1.26 |
/test ci/centos/mini-e2e/k8s-1.27 |
Describe what this PR does
Implemented the capability to include kernel and fuse mount options
for individual clusters within the ceph-csi-config ConfigMap.
This allows users to configure the kernel and fuse mount options
for each cluster separately. The mount options specified in the ConfigMap
will supersede those provided via command line arguments.
Is there anything that requires special attention
Is the change backward compatible?
Yes
Checklist:
guidelines in the developer
guide.
updated with breaking and/or notable changes for the next major release.
Show available bot commands
These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:
/retest ci/centos/<job-name>
: retest the<job-name>
after unrelatedfailure (please report the failure too!)