mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Hugepages to pod level supported resources
This commit is contained in:
parent
949abfc34f
commit
e5020285fa
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
package resource
|
package resource
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
)
|
)
|
||||||
@ -56,14 +58,14 @@ type PodResourcesOptions struct {
|
|||||||
var supportedPodLevelResources = sets.New(v1.ResourceCPU, v1.ResourceMemory)
|
var supportedPodLevelResources = sets.New(v1.ResourceCPU, v1.ResourceMemory)
|
||||||
|
|
||||||
func SupportedPodLevelResources() sets.Set[v1.ResourceName] {
|
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
|
// IsSupportedPodLevelResources checks if a given resource is supported by pod-level
|
||||||
// resource management through the PodLevelResources feature. Returns true if
|
// resource management through the PodLevelResources feature. Returns true if
|
||||||
// the resource is supported.
|
// the resource is supported.
|
||||||
func IsSupportedPodLevelResource(name v1.ResourceName) bool {
|
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.
|
// IsPodLevelResourcesSet check if PodLevelResources pod-level resources are set.
|
||||||
|
Loading…
Reference in New Issue
Block a user