Repository navigation
feat: support configuring static hugepages (backport #251) - #261
Merged
Merged
Conversation
Currently, Harvester takes over managment of 2MiB hugeapges in order to support the Longhorn V2 data engine. If the LHv2 data engine is enabled, by default Harvester will allocate 1024 x 2MiB hugepages, and if the LHv2 data engine is disabled, Harvester will delallocate those hugepages. This is problemaic when hugepages are needed for purposes other than the Longhorn v2 data engine. We need to allow users to allocate hugepages on a per-node basis, while ensuring that there are sufficient hugepages available for Longhorn if the V2 data engine is enabled. This commit adds static.nrHugepages to the current hugepage CR, and moves hugepages allocation and config persistence from the nodeconfig controller to the hugepage controller. If the LH V2 data engine is enabled and there's not enough hugepages, the number of hugepages currently allocated will be bumped up by the number required by Longhorn. An admission webhook ensures that the user can't subsequently deallocate hugepages if they're required by Longhorn. When the LHv2 data engine is _disabled_, there is no automatic deallocation of hugepages anymore, so users disabling the LHv2 data engine will have to also set static.nrHugepages to zero on each node (the alternative would have been to add some sort of annotation maybe to track when LHv2 was enabled and disabled, but honestly I don't think the extra complexity is worth it). Related-to: harvester/harvester#9459 Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 1604e7f)
Related-to: harvester/harvester#9459 Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit afab727)
This avoids unnecessarily rewriting /oem/99_settings.yaml potentially every thirty seconds when hugepage.OnChange() happens. We don't have a DeepCopy() for YipConfig, which means we can't use reflect.DeepEqual(), so instead I went with string comparison on "%+v" as an easy fallback. Related-to: harvester/harvester#9459 Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 19d5bd8)
The bump semantics are too weird, it's better to just set the number required. Related-to: harvester/harvester#9459 Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit b8df029)
Co-authored-by: Volker Theile <votdev@gmx.de> Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 6ffcb35)
Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 9c4e43d)
Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 37fc462)
Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit be836e7)
Signed-off-by: Tim Serong <tserong@suse.com> (cherry picked from commit 6c0b843)
mergify
Bot
requested review from
a team,
brandboat and
tserong
as code owners
November 18, 2026 00:12
Author
|
This pull request is merged. |
tserong
approved these changes
Nov 18, 2026
tserong
left a comment
Member
There was a problem hiding this comment.
🤔 can I approve my own backport?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Currently, Harvester takes over managment of 2MiB hugeapges in order to support the Longhorn V2 data engine. If the LHv2 data engine is enabled, by default Harvester will allocate 1024 x 2MiB hugepages, and if the LHv2 data engine is disabled, Harvester will delallocate those hugepages. This is problemaic when hugepages are needed for purposes other than the Longhorn v2 data engine. We need to allow users to allocate hugepages on a per-node basis, while ensuring that there are sufficient hugepages available for Longhorn if the V2 data engine is enabled.
Solution:
This commit adds static.hugepages to the current hugepage CR, and moves hugepages allocation and config persistence from the nodeconfig controller to the hugepage controller. If the LH V2 data engine is enabled and there's not enough hugepages, the number of hugepages currently allocated will be set to the number required by Longhorn. An admission webhook ensures that the user can't subsequently deallocate hugepages if they're required by Longhorn.
When the LHv2 data engine is disabled, there is no automatic deallocation of hugepages anymore, so users disabling the LHv2 data engine will have to also set static.hugepages to zero on each node (the alternative would have been to add some sort of annotation maybe to track when LHv2 was enabled and disabled, but honestly I don't think the extra complexity is worth it).
Related Issue(s):
harvester/harvester#9459
Test plan:
See the HEP (currently WIP at harvester/harvester#12229)
Additional documentation or context
This will require a matching change to harvester/charts, see harvester/charts#674
This is an automatic backport of pull request #251 done by Mergify.