@@ -18,7 +18,6 @@ package noderesourcetopology
1818
1919import (
2020 "context"
21-
2221 v1 "k8s.io/api/core/v1"
2322 "k8s.io/klog/v2"
2423 v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos"
@@ -180,6 +179,11 @@ func singleNUMAPodLevelHandler(lh logr.Logger, pod *v1.Pod, zones topologyv1alph
180179 return nil
181180}
182181
182+ func rejectNonSingleNUMANodeHandler (lh logr.Logger , _ * v1.Pod , _ topologyv1alpha2.ZoneList , nodeInfo * framework.NodeInfo ) * framework.Status {
183+ lh .Info ("Rejecting node because it is not configured with Single NUMA Node policy" , "node" , klog .KObj (nodeInfo .Node ()))
184+ return framework .NewStatus (framework .Unschedulable , "Node does not have Single NUMA Node policy" )
185+ }
186+
183187// Filter Now only single-numa-node supported
184188func (tm * TopologyMatch ) Filter (ctx context.Context , cycleState * framework.CycleState , pod * v1.Pod , nodeInfo * framework.NodeInfo ) * framework.Status {
185189 if nodeInfo .Node () == nil {
@@ -223,14 +227,17 @@ func (tm *TopologyMatch) Filter(ctx context.Context, cycleState *framework.Cycle
223227}
224228
225229func filterHandlerFromTopologyManager (conf nodeconfig.TopologyManager ) filterFn {
226- if conf .Policy != kubeletconfig .SingleNumaNodeTopologyManagerPolicy {
227- return nil
230+ if conf .Policy != kubeletconfig .SingleNumaNodeTopologyManagerPolicy &&
231+ conf .Policy != kubeletconfig .BestEffortTopologyManagerPolicy &&
232+ conf .Policy != kubeletconfig .RestrictedTopologyManagerPolicy {
233+ return rejectNonSingleNUMANodeHandler
228234 }
229- if conf .Scope == kubeletconfig .PodTopologyManagerScope {
235+ switch conf .Scope {
236+ case kubeletconfig .PodTopologyManagerScope :
230237 return singleNUMAPodLevelHandler
231- }
232- if conf .Scope == kubeletconfig .ContainerTopologyManagerScope {
238+ case kubeletconfig .ContainerTopologyManagerScope :
233239 return singleNUMAContainerLevelHandler
240+ default :
241+ return nil
234242 }
235- return nil // cannot happen
236243}
0 commit comments