Skip to content

feat: support configuring static hugepages (backport #251) - #261

Merged
Vicente-Cheng merged 9 commits into
v1.10from
mergify/bp/v1.10/pr-251
Nov 18, 2026
Merged

Vicente-Cheng merged 9 commits into
v1.10from
mergify/bp/v1.10/pr-251

Conversation

@mergify

@mergify mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown

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.

tserong and others added 9 commits November 18, 2026 00:11
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
mergify Bot requested review from a team, brandboat and tserong as code owners November 18, 2026 00:12
@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Author

This pull request is merged.

@tserong tserong left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤔 can I approve my own backport?

@Vicente-Cheng
Vicente-Cheng merged commit c172501 into v1.10 Nov 18, 2026
7 checks passed
@Vicente-Cheng
Vicente-Cheng deleted the mergify/bp/v1.10/pr-251 branch November 18, 2026 08:54
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.

2 participants