Skip to content

Commit e502028

Browse files
committed
Hugepages to pod level supported resources
1 parent 949abfc commit e502028

File tree

1 file changed

+4
-2
lines changed
  • staging/src/k8s.io/component-helpers/resource

1 file changed

+4
-2
lines changed

staging/src/k8s.io/component-helpers/resource/helpers.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package resource
1818

1919
import (
20+
"strings"
21+
2022
v1 "k8s.io/api/core/v1"
2123
"k8s.io/apimachinery/pkg/util/sets"
2224
)
@@ -56,14 +58,14 @@ type PodResourcesOptions struct {
5658
var supportedPodLevelResources = sets.New(v1.ResourceCPU, v1.ResourceMemory)
5759

5860
func SupportedPodLevelResources() sets.Set[v1.ResourceName] {
59-
return supportedPodLevelResources
61+
return supportedPodLevelResources.Clone().Insert(v1.ResourceHugePagesPrefix)
6062
}
6163

6264
// IsSupportedPodLevelResources checks if a given resource is supported by pod-level
6365
// resource management through the PodLevelResources feature. Returns true if
6466
// the resource is supported.
6567
func IsSupportedPodLevelResource(name v1.ResourceName) bool {
66-
return supportedPodLevelResources.Has(name)
68+
return supportedPodLevelResources.Has(name) || strings.HasPrefix(string(name), v1.ResourceHugePagesPrefix)
6769
}
6870

6971
// IsPodLevelResourcesSet check if PodLevelResources pod-level resources are set.

0 commit comments

Comments
 (0)