cephfs: support MDS pinning via ControllerModifyVolume - #6390
Conversation
nixpanic
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I had a first view over this, and it looks reasonable to me.
The only thing that is missing, is a test case under e2e/cephfs.go. See how e2e/nvmeof.go uses a VolumeAttributesClass to apply a change
Address review feedback on PR ceph#6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
Address review feedback on PR ceph#6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
4334ae7 to
3639d32
Compare
|
/test ci/centos/mini-e2e/k8s-1.37/cephfs |
|
The new e2e test "create a PVC with a VolumeAttributesClass for MDS pinning and modify it" failed. It looks like an issue related to a missing RBAC: In ceph-csi/deploy/rbd/kubernetes/csi-provisioner-rbac.yaml Lines 84 to 86 in 7e9580b Commit ef8b07a added the permissions to the Helm Chart for RBD. This needs to be done for the CephFS Helm Chart as well. |
|
/test ci/centos/mini-e2e/k8s-1.37/cephfs |
1 similar comment
|
/test ci/centos/mini-e2e/k8s-1.37/cephfs |
|
@Mergifyio rebase |
🛑 The pull request rule doesn't match anymoreDetailsThis action has been cancelled. |
Address review feedback on PR ceph#6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
0063e9e to
b8b5c07
Compare
|
/test ci/centos/mini-e2e/k8s-1.37/cephfs |
| // go-ceph's typed PinSubVolume helper does not accept a subvolume group, so it | ||
| // would always target Ceph's default group and fail for subvolumes created in | ||
| // a non-default group (as ceph-csi does). To support any group, the "fs |
There was a problem hiding this comment.
@ismaelpuerto can we please fix this in go-ceph and open an issue to adopt to go-ceph API once its implemented?
There was a problem hiding this comment.
Thanks for the review, I just create the issue : ceph/go-ceph#1293
| if len(req.GetMutableParameters()) != 0 { | ||
| if err = applyMutableParameters(ctx, volClient, vID.FsSubvolName, | ||
| req.GetMutableParameters()); err != nil { | ||
| return nil, err |
There was a problem hiding this comment.
if applyMutableParameters fail then we might need to clean the Subvolume orelse it will be orphaned.
You need to call PurgeVolume here.
| for _, key := range mdsPinParams { | ||
| value, ok := params[key] | ||
| if !ok { | ||
| continue |
There was a problem hiding this comment.
This will silently ignore unknown mutable parameters. CSI spec recommends InvalidArgument for unsupported parameters.
| if err != nil { | ||
| logAndFail("failed to get bound PV: %v", err) | ||
| } | ||
| if pv.Spec.VolumeAttributesClassName == nil || |
There was a problem hiding this comment.
This only verifies the frontend part (validating the VAC reference in PV object), but doesn't validate on the backend if the pinning is applied on subvolume. Do you think that is possible to add coverage for this?
There was a problem hiding this comment.
Thanks for the review. I looked into validating the pin on the backend and wanted to share what I found, as it affects how we can assert it in e2e.
1. ceph fs subvolume info does not expose the pin. Tested on Ceph 19 (Squid)
2. The pin is not visible from the application pod. ceph fs subvolume pin applies ceph.dir.pin on the subvolume directory (/volumes/csi/csi-vol-<id>/), but CSI mounts the data subdirectory (.../<uuid>/) as the volume root. So getfattr -n ceph.dir.pin from the pod always reports -1 even after a successful pin.
3. The only way to assert the pin is to mount the whole filesystem and read ceph.dir.pin on /volumes/csi/csi-vol-<id>/. Doable in the toolbox but adds mount setup/teardown and is more fragile than the rest of the CephFS e2e suite.
Would you prefer (a) a toolbox-side full-fs mount + getfattr verification on the subvolume directory, or keeping the current front-end assertion and documenting the backend-verification limitation?
There was a problem hiding this comment.
@iPraveenParihar , do you have an opinion on this?
I guess it would be nice to check the xattr, but mounting the subvolume directory (parent directory of the user visible volume) is a little tricky...
There was a problem hiding this comment.
Yea, lets keep it the current front-end assertion for now to not complex this PR. Let create a tracker to address backend assertion?
There was a problem hiding this comment.
Sounds good, thanks! I've opened #6460 to track the backend assertion
Pull request has been modified.
|
Thanks again @ismaelpuerto! The code looks good to me. Can you please squash the last commit into the one that adds the new functionality (1st commit)? That makes the history of the commits cleaner and easier to follow. |
Address review feedback on PR ceph#6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
903daef to
47aa45f
Compare
|
/test ci/centos/mini-e2e/k8s-1.36/cephfs |
Merge Queue Status
This pull request spent 4 hours 2 minutes 37 seconds in the queue, including 4 hours 1 minute 24 seconds running CI. Required conditions to merge
|
|
/retest ci/centos/mini-e2e/k8s-1.36 |
|
/retest ci/centos/mini-e2e/k8s-1.35 |
|
/retest ci/centos/mini-e2e/k8s-1.34 |
|
Deprecation notice: This pull request comes from a fork and was queued with |
Expose the RPC_MODIFY_VOLUME capability on the CephFS controller and map the mutable VolumeAttributesClass parameters mds-pin-export, mds-pin-distributed and mds-pin-random to "ceph fs subvolume pin". This lets administrators change the MDS distribution policy of an existing subvolume at runtime without recreating the volume. The three pin parameters are mutually exclusive and validated before being applied. A new PinVolume method on the SubVolumeClient wraps go-ceph's PinSubVolume; since go-ceph does not expose a subvolume-group aware variant, the pin is applied against Ceph's default subvolume group, which is documented as a known limitation. Adds unit tests for the parameter validation, an example VolumeAttributesClass and documentation in the CephFS deployment guide. Fixes: ceph#6378 Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
Address review feedback on PR ceph#6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
The CephFS provisioner needs to read VolumeAttributesClass objects to support MDS pinning via ControllerModifyVolume. Without this the e2e test fails with "cannot get resource volumeattributesclasses in API group storage.k8s.io at the cluster scope". Add the required RBAC rule to both the static deployment manifest and the CephFS Helm chart, matching what RBD already has. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
The "fs subvolume pin" manager command was issued through go-ceph's PinSubVolume helper, which does not accept a subvolume group. Ceph then looked the subvolume up in the default group and returned ENOENT for subvolumes created in a non-default group, which is the case for ceph-csi (and the e2e test uses the "e2e" group): failed to pin subvolume csi-vol-... in fs myfs: rados: ret=-2, No such file or directory: "subvolume 'csi-vol-...' does not exist" Issue the "fs subvolume pin" command directly with group_name set, via a new MgrCommand passthrough on ClusterConnection, so pinning works for any subvolume group. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
2c0aa6a to
0df28bc
Compare
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/k8s-e2e-external-storage/1.34 |
|
/test ci/centos/mini-e2e-helm/k8s-1.34 |
|
/test ci/centos/k8s-e2e-external-storage/1.35 |
|
/test ci/centos/mini-e2e/k8s-1.34 |
|
/test ci/centos/mini-e2e-helm/k8s-1.35 |
|
/test ci/centos/mini-e2e/k8s-1.35 |
|
/test ci/centos/k8s-e2e-external-storage/1.36 |
|
/test ci/centos/mini-e2e-helm/k8s-1.36 |
|
/test ci/centos/mini-e2e/k8s-1.36 |
Address review feedback on PR #6390: the mutable VolumeAttributesClass parameters must also be applied during CreateVolume, not only through ControllerModifyVolume. Following the pattern in the NFS driver, the pin logic is moved into an applyMutableParameters helper so that locking and volume resolution happen only once, and both CreateVolume and ControllerModifyVolume reuse it. Also add an e2e test under e2e/cephfs.go that creates a PVC referencing a VolumeAttributesClass with an mds-pin-export rank, verifies the class is applied at creation time, and then updates the PVC to a second class to exercise the ControllerModifyVolume path. Assisted-by: goose <noreply@block.xyz> Signed-off-by: Ismael Puerto Freire <ismaelpf@inditex.com>
Expose the RPC_MODIFY_VOLUME capability on the CephFS controller and map the mutable VolumeAttributesClass parameters mds-pin-export, mds-pin-distributed and mds-pin-random to "ceph fs subvolume pin". This lets administrators change the MDS distribution policy of an existing subvolume at runtime without recreating the volume.
The three pin parameters are mutually exclusive and validated before being applied. A new PinVolume method on the SubVolumeClient wraps go-ceph's PinSubVolume; since go-ceph does not expose a subvolume-group aware variant, the pin is applied against Ceph's default subvolume group, which is documented as a known limitation.
Adds unit tests for the parameter validation, an example VolumeAttributesClass and documentation in the CephFS deployment guide.
Describe what this PR does
Provide some context for the reviewer
Is there anything that requires special attention
Do you have any questions?
Is the change backward compatible?
Are there concerns around backward compatibility?
Provide any external context for the change, if any.
For example:
Related issues
Fixes: #6378
Depends-on: #6458
Future concerns
List items that are not part of the PR and do not impact it's
functionality, but are work items that can be taken up subsequently.
Checklist:
guidelines in the developer
guide.
Request
notes
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!)