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

feat: controller only expansion #898

Closed

Conversation

jakobmoellerdev
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev commented Apr 24, 2024

This change is prototyping how using the native LVM device paths reported by device mapper could work together with lvm controlled filesystem resizing in order to run controller-only online/offline volume expansion.

The main benefit of this is significantly faster resizing due to not having to wait for kubelet expansion. Additionally we no longer have to maintain our own devices in /dev/topolvm. (fix #902)

Note that the current design breaks with existing TopoLVM because it switches from using the TopoLVM device directory to using the lvm owned device paths (so TopoLVM no longer renames the devices). Unmounting via lvm2 provided device paths always works even if legacy paths exist.

I want to drive a POC here so that I can further debug and showcase how much more efficient we could be regarding dealing with device paths, lvm compatibility and the CSI spec. I think this approach is feasible and I would like to open it for reviews

Summary of Changes:

  • Change all ControllerExpandVolumeResponses to NodeExpansionRequired: false
  • Extend lvmd with resize behavior instead of NodeExpansion
  • Allow lvmd to temporarily do a mount for resizing of PVCs under /tmp when there is currently no mount for the filesystem, otherwise reuse the mount present.

@jakobmoellerdev jakobmoellerdev force-pushed the controller-based-expand branch 11 times, most recently from f6478f7 to 56317be Compare April 24, 2024 19:45
@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review June 5, 2024 10:19
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner June 5, 2024 10:19
@jakobmoellerdev jakobmoellerdev changed the title [WIP] feat!: controller only expansion and lvm native devices feat!: controller only expansion and lvm native devices Jun 5, 2024
@jakobmoellerdev jakobmoellerdev changed the title feat!: controller only expansion and lvm native devices feat: controller only expansion and lvm native devices Jun 5, 2024
@toshipp toshipp requested review from toshipp and removed request for cupnes June 6, 2024 05:07
@toshipp
Copy link
Contributor

toshipp commented Jun 6, 2024

Since I've not concluded avoiding NodeExpandVolume yet, I'd like to separate this PR into making expansion faster and not using /dev/topolvm.

@jakobmoellerdev
Copy link
Contributor Author

How would you be able to achieve that? I am combining these since you need a path in the Controller and I would have to migrate the entirety of /dev/topolvm device logic into the controller first otherwise

@toshipp
Copy link
Contributor

toshipp commented Jun 6, 2024

IIUC, all logic on node.go you wrote is valid if lvmd tells us lv device paths. So we could review the decommission of /dev/topolvm first.

@jakobmoellerdev
Copy link
Contributor Author

Understand what you mean now, will work on separating this out, might take a bit

Copy link
Contributor

github-actions bot commented Jul 6, 2024

This pull request has been automatically marked as stale because it has not had any activity for 30 days. It will be closed in a week if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 6, 2024
@toshipp toshipp added keepalive and removed stale labels Jul 8, 2024
Signed-off-by: Jakob Möller <jmoller@redhat.com>
Signed-off-by: Jakob Möller <jmoller@redhat.com>
Signed-off-by: Jakob Möller <jmoller@redhat.com>
Signed-off-by: Jakob Möller <jmoller@redhat.com>
Signed-off-by: Jakob Möller <jmoller@redhat.com>
Signed-off-by: Jakob Möller <jmoller@redhat.com>
@jakobmoellerdev jakobmoellerdev changed the title feat: controller only expansion and lvm native devices feat: controller only expansion Jul 16, 2024
@jakobmoellerdev
Copy link
Contributor Author

@toshipp @peng225 I have now extracted the device changes out into the recently merged PR and rebased on main. The only changes left are now the controller based expansion. PTAL and let me know what you think of it.

@toshipp
Copy link
Contributor

toshipp commented Jul 17, 2024

@jakobmoellerdev
Thank you for your update. We'll dig into the problem, but it will take time, IMO. Please wait for a while.

@toshipp
Copy link
Contributor

toshipp commented Aug 26, 2024

@jakobmoellerdev
I am investigating the slow expansion issue and suspect kubelet's reconcile mechanism.
I have found a way to speed up e2e testing. Would you like to speed up e2e tests? Or the real environment?

@jakobmoellerdev
Copy link
Contributor Author

The slow expand is because the kubelets desired state of world populator, but my issue is that we should not need to wait for the node if we already interact with lvmd, hence my PR.

So my desire is to speed up both. Real life expands take as much as testing

@toshipp
Copy link
Contributor

toshipp commented Aug 26, 2024

Thanks.
I think it is not a good idea to abuse ControllerExpandVolume to resize a filesystem. I found that mutating a pod makes kubelet work faster, it might be a better solution. Maybe this should be solved by the kubernetes project. I am looking into it more.

@jakobmoellerdev
Copy link
Contributor Author

I think your concern is valid. Let me know if you need any input from me to proceed.

@toshipp toshipp mentioned this pull request Aug 27, 2024
@toshipp
Copy link
Contributor

toshipp commented Sep 2, 2024

@jakobmoellerdev
I tried to solve this problem by kubelet watching PVC, but the attempt failed because the authors who implemented online resizing of PV had decided not to watch PV/PVC directly, but to use the existing pod resync loop. see kubernetes/community#1535 (comment).
So now I agree with the idea to solve it in topolvm. But as I mentioned before, I think the PR is not good because it abuses ControllerExpandVolume where CSI spec does not expect to resize a filesystem.
I tested another solution to notify kubelet by mutating pods on #956, it worked. I'd like to proceed with this, do you have any comments?

@jakobmoellerdev
Copy link
Contributor Author

But as I mentioned before, I think the PR is not good because it abuses ControllerExpandVolume where CSI spec does not expect to resize a filesystem.

I think this assumption is not quite correct. ControllerExpandVolume is abstracted from filesystem management. Thats why one can set NodeVolumeExpansionRequired to true.

Nevertheless I think for code simplicity I agree, we can move forward with "nudging" the pod to do what we want, as it maintains our code paths better. I suggest we add some documentation to that pr and close this one out

@jakobmoellerdev
Copy link
Contributor Author

Closing in favor of #956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

TopoLVM should not use the /dev/topolvm devices but use lvm2 lv output as source of truth
2 participants