From e5020285fa27b0d3b2587d2167f89ee05e86a8d4 Mon Sep 17 00:00:00 2001 From: Kevin Torres Date: Wed, 19 Feb 2025 19:29:41 +0000 Subject: [PATCH] Hugepages to pod level supported resources --- staging/src/k8s.io/component-helpers/resource/helpers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/component-helpers/resource/helpers.go b/staging/src/k8s.io/component-helpers/resource/helpers.go index 683dc3ad8b8..291510fc920 100644 --- a/staging/src/k8s.io/component-helpers/resource/helpers.go +++ b/staging/src/k8s.io/component-helpers/resource/helpers.go @@ -17,6 +17,8 @@ limitations under the License. package resource import ( + "strings" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" ) @@ -56,14 +58,14 @@ type PodResourcesOptions struct { var supportedPodLevelResources = sets.New(v1.ResourceCPU, v1.ResourceMemory) func SupportedPodLevelResources() sets.Set[v1.ResourceName] { - return supportedPodLevelResources + return supportedPodLevelResources.Clone().Insert(v1.ResourceHugePagesPrefix) } // IsSupportedPodLevelResources checks if a given resource is supported by pod-level // resource management through the PodLevelResources feature. Returns true if // the resource is supported. func IsSupportedPodLevelResource(name v1.ResourceName) bool { - return supportedPodLevelResources.Has(name) + return supportedPodLevelResources.Has(name) || strings.HasPrefix(string(name), v1.ResourceHugePagesPrefix) } // IsPodLevelResourcesSet check if PodLevelResources pod-level resources are set.