Skip to content

bugfix(noderesourcetopology): reject non-single-numa-node policies in NodeResourceTopology plugin #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions pkg/noderesourcetopology/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func singleNUMAPodLevelHandler(lh logr.Logger, pod *v1.Pod, zones topologyv1alph
return nil
}

func rejectNonSingleNUMANodeHandler(lh logr.Logger, _ *v1.Pod, _ topologyv1alpha2.ZoneList, nodeInfo *framework.NodeInfo) *framework.Status {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we add another handler to handle this case

lh.Info("Rejecting node because it is not configured with Single NUMA Node policy", "node", klog.KObj(nodeInfo.Node()))
return framework.NewStatus(framework.Unschedulable, "Node does not have Single NUMA Node policy")
}

// Filter Now only single-numa-node supported
func (tm *TopologyMatch) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
if nodeInfo.Node() == nil {
Expand Down Expand Up @@ -223,14 +228,17 @@ func (tm *TopologyMatch) Filter(ctx context.Context, cycleState *framework.Cycle
}

func filterHandlerFromTopologyManager(conf nodeconfig.TopologyManager) filterFn {
if conf.Policy != kubeletconfig.SingleNumaNodeTopologyManagerPolicy {
return nil
if conf.Policy != kubeletconfig.SingleNumaNodeTopologyManagerPolicy &&
conf.Policy != kubeletconfig.BestEffortTopologyManagerPolicy &&
conf.Policy != kubeletconfig.RestrictedTopologyManagerPolicy {
return rejectNonSingleNUMANodeHandler
}
if conf.Scope == kubeletconfig.PodTopologyManagerScope {
switch conf.Scope {
case kubeletconfig.PodTopologyManagerScope:
return singleNUMAPodLevelHandler
}
if conf.Scope == kubeletconfig.ContainerTopologyManagerScope {
case kubeletconfig.ContainerTopologyManagerScope:
return singleNUMAContainerLevelHandler
default:
return nil
}
return nil // cannot happen
}