@@ -27,7 +27,6 @@ import (
2727 v1 "k8s.io/api/core/v1"
2828 "k8s.io/apimachinery/pkg/api/resource"
2929 utilfeature "k8s.io/apiserver/pkg/util/feature"
30- resourcehelper "k8s.io/component-helpers/resource"
3130 "k8s.io/klog/v2"
3231 podutil "k8s.io/kubernetes/pkg/api/v1/pod"
3332 corehelper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
@@ -39,12 +38,7 @@ import (
3938 "k8s.io/kubernetes/pkg/kubelet/metrics"
4039)
4140
42- const (
43- PolicyTypeStatic policyType = "Static"
44-
45- // ErrorMemoryManagerPodLevelResources represents the type of a MemoryManagerPodLevelResourcesError
46- ErrorMemoryManagerPodLevelResources = "MemoryManagerPodLevelResourcesError"
47- )
41+ const PolicyTypeStatic policyType = "Static"
4842
4943type systemReservedMemory map [int ]map [v1.ResourceName ]uint64
5044type reusableMemory map [string ]map [string ]map [v1.ResourceName ]uint64
@@ -66,16 +60,6 @@ type staticPolicy struct {
6660
6761var _ Policy = & staticPolicy {}
6862
69- type MemoryManagerPodLevelResourcesError struct {}
70-
71- func (e MemoryManagerPodLevelResourcesError ) Type () string {
72- return ErrorMemoryManagerPodLevelResources
73- }
74-
75- func (e MemoryManagerPodLevelResourcesError ) Error () string {
76- return "Memory Manager static policy does not support pod-level resources"
77- }
78-
7963// NewPolicyStatic returns new static policy instance
8064func NewPolicyStatic (ctx context.Context , machineInfo * cadvisorapi.MachineInfo , reserved systemReservedMemory , affinity topologymanager.Store ) (Policy , error ) {
8165 var totalSystemReserved uint64
@@ -123,10 +107,6 @@ func (p *staticPolicy) Allocate(ctx context.Context, s state.State, pod *v1.Pod,
123107 return nil
124108 }
125109
126- if p .isPodWithPodLevelResources (ctx , pod ) {
127- return MemoryManagerPodLevelResourcesError {}
128- }
129-
130110 podUID := string (pod .UID )
131111 logger .Info ("Allocate" )
132112 // container belongs in an exclusively allocated pool
@@ -426,10 +406,6 @@ func (p *staticPolicy) GetPodTopologyHints(ctx context.Context, s state.State, p
426406 return nil
427407 }
428408
429- if p .isPodWithPodLevelResources (ctx , pod ) {
430- return nil
431- }
432-
433409 reqRsrcs , err := getPodRequestedResources (pod )
434410 if err != nil {
435411 logger .Error (err , "Failed to get pod requested resources" , "podUID" , pod .UID )
@@ -460,10 +436,6 @@ func (p *staticPolicy) GetTopologyHints(ctx context.Context, s state.State, pod
460436 return nil
461437 }
462438
463- if p .isPodWithPodLevelResources (ctx , pod ) {
464- return nil
465- }
466-
467439 requestedResources , err := getRequestedResources (pod , container )
468440 if err != nil {
469441 logger .Error (err , "Failed to get container requested resources" , "podUID" , pod .UID , "containerName" , container .Name )
@@ -1104,16 +1076,3 @@ func isAffinityViolatingNUMAAllocations(machineState state.NUMANodeMap, mask bit
11041076 }
11051077 return false
11061078}
1107-
1108- func (p * staticPolicy ) isPodWithPodLevelResources (ctx context.Context , pod * v1.Pod ) bool {
1109- logger := klog .FromContext (ctx )
1110-
1111- if utilfeature .DefaultFeatureGate .Enabled (features .PodLevelResources ) && resourcehelper .IsPodLevelResourcesSet (pod ) {
1112- // The Memory manager static policy does not support pod-level resources.
1113- logger .V (5 ).Info ("Memory manager allocation skipped, pod is using pod-level resources which are not supported by the static Memory manager policy" , "pod" , klog .KObj (pod ))
1114-
1115- return true
1116- }
1117-
1118- return false
1119- }
0 commit comments