Skip to content
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

Conversation

iPraveenParihar
Copy link
Contributor

@iPraveenParihar iPraveenParihar commented Nov 8, 2023

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:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes
    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

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 unrelated
    failure (please report the failure too!)

@iPraveenParihar iPraveenParihar changed the title Feature/kernel fuse mount options per cluster CephFS: kernel and fuse mount options per cluster Nov 8, 2023
@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch 2 times, most recently from 12538e0 to 9a66115 Compare November 8, 2023 06:15
@iPraveenParihar iPraveenParihar marked this pull request as ready for review November 8, 2023 06:16
@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from 9a66115 to a43e630 Compare November 8, 2023 06:27
Comment on lines 797 to 803

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
}
Copy link
Contributor

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.

Suggested change
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
}

@@ -316,12 +316,19 @@ func (ns *NodeServer) mount(
mountOptions = m.GetMountFlags()
}

mntOptions, err := ns.getMountOptions(mnt, volOptions)
Copy link
Contributor

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 ?

@@ -316,12 +316,19 @@ func (ns *NodeServer) mount(
mountOptions = m.GetMountFlags()
}
Copy link
Contributor

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.

@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch 2 times, most recently from 7457046 to e22b23f Compare November 8, 2023 14:50
Copy link
Contributor

mergify bot commented Nov 8, 2023

This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏

@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from e22b23f to 3fafd2e Compare November 14, 2023 06:50
@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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",
Copy link
Contributor

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.

Copy link
Contributor Author

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.

if m := volCap.GetMount(); m != nil {
mountOptions = m.GetMountFlags()
}
err = ns.getMountOptions(mnt, volOptions, volCap)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from 3fafd2e to 5367aaa Compare November 14, 2023 08:26
internal/cephfs/nodeserver.go Outdated Show resolved Hide resolved
internal/cephfs/nodeserver.go Outdated Show resolved Hide resolved
internal/cephfs/nodeserver.go Show resolved Hide resolved
internal/util/csiconfig_test.go Outdated Show resolved Hide resolved
@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch 3 times, most recently from fbda7a8 to 59da859 Compare November 14, 2023 15:09
@iPraveenParihar
Copy link
Contributor Author

/test ci/centos/mini-e2e/k8s-1.28

@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from 59da859 to a56a8b7 Compare November 15, 2023 05:18
Rakshith-R
Rakshith-R previously approved these changes Nov 15, 2023
PendingReleaseNotes.md Outdated Show resolved Hide resolved
deploy/csi-config-map-sample.yaml Outdated Show resolved Hide resolved
@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from a56a8b7 to 4c6063f Compare November 15, 2023 08:22
@mergify mergify bot dismissed Rakshith-R’s stale review November 15, 2023 08:22

Pull request has been modified.

Copy link
Collaborator

@Madhu-1 Madhu-1 left a 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?

deploy/csi-config-map-sample.yaml Outdated Show resolved Hide resolved
@iPraveenParihar iPraveenParihar force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from 4c6063f to 35ca751 Compare November 15, 2023 08:54
@iPraveenParihar
Copy link
Contributor Author

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?

Added a check for empty ClusterID.

Copy link
Collaborator

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Rakshith-R
Copy link
Contributor

@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>
Copy link
Contributor

mergify bot commented Nov 15, 2023

rebase

✅ Branch has been successfully rebased

@Rakshith-R Rakshith-R force-pushed the feature/kernel-fuse-mount-options-per-cluster branch from 35ca751 to 3e60a29 Compare November 15, 2023 09:12
@Rakshith-R
Copy link
Contributor

@Mergifyio queue

Copy link
Contributor

mergify bot commented Nov 15, 2023

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 4ee466b

@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Nov 15, 2023
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Nov 15, 2023
@mergify mergify bot merged commit 4ee466b into ceph:devel Nov 15, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants