Change:
Follow up from: See details there. When is , there is no need to discover the NUMA topology. /sig node /priority backlog /kind feature /help-wanted
/cc
/triage accepted
I would like to take this up also can I get more brief information about it? code review comments from asking that inside the NewManager() implementation, we need to skip NewPolicyOptions and NewNUMAInfo but when the NumaTopology comes kubelet issue also comes. I need some more information to start with this!
/cc
When there is no topology manger policy specified, NewManager should be a no-op. Just skip all checks.
Exactly. Just to add: we may need few iterations over the change to get a clean flow in the call.
/assign

Discussion:
containerTopologyScope = "container" // podTopologyScope specifies the TopologyManagerScope per pod. podTopologyScope = "pod" <ins> // noneTopologyScope specifies the TopologyManagerScope when topologyPolicyName is none. noneTopologyScope = "none" </ins> ) type podTopologyHints map[string]map[string]TopologyHint

} func (s *containerScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { <del> // Exception - Policy : none if s.policy.Name() == PolicyNone { return s.admitPolicyNone(pod) } </del> for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) { bestHint, admit := s.calculateAffinity(pod, &container) klog.InfoS("Best TopologyHint", "bestHint", bestHint, "pod", klog.KObj(pod), "containerName", container.Name)

<ins> /* Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package topologymanager import ( "k8s.io/api/core/v1" "k8s.io/kubernetes/pkg/kubelet/cm/containermap" "k8s.io/kubernetes/pkg/kubelet/lifecycle" ) type noneScope struct { scope } // Ensure noneScope implements Scope interface var _ Scope = &noneScope{} // NewNoneScope returns a none scope. func NewNoneScope() Scope { return &noneScope{ scope{ name:             noneTopologyScope, podTopologyHints: podTopologyHints{}, policy:           NewNonePolicy(), podMap:           containermap.NewContainerMap(), }, } } func (s *noneScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { return s.admitPolicyNone(pod) } </ins>

} func (s *podScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { <del> // Exception - Policy : none if s.policy.Name() == PolicyNone { return s.admitPolicyNone(pod) } </del> bestHint, admit := s.calculateAffinity(pod) klog.InfoS("Best TopologyHint", "bestHint", bestHint, "pod", klog.KObj(pod)) if !admit {

func NewManager(topology []cadvisorapi.Node, topologyPolicyName string, topologyScopeName string, topologyPolicyOptions map[string]string) (Manager, error) { klog.InfoS("Creating topology manager with policy per scope", "topologyPolicyName", topologyPolicyName, "topologyScopeName", topologyScopeName) <ins> // When policy is none, the scope is not relevant, so we can short circuit here. if topologyPolicyName == PolicyNone { return &manager{scope: NewNoneScope()}, nil } </ins> opts, err := NewPolicyOptions(topologyPolicyOptions) if err != nil { return nil, err

var policy Policy switch topologyPolicyName { <del> case PolicyNone: policy = NewNonePolicy() </del> case PolicyBestEffort: policy = NewBestEffortPolicy(numaInfo, opts)

} } else { rawMgr := mngr.(*manager) <del> rawScope := rawMgr.scope.(*containerScope) if rawScope.policy.Name() != tc.expectedPolicy { t.Errorf("Unexpected policy name. Have: %q wants %q", rawScope.policy.Name(), tc.expectedPolicy) </del> <ins> var policyName string if rawScope, ok := rawMgr.scope.(*containerScope); ok { policyName = rawScope.policy.Name() } else if rawScope, ok := rawMgr.scope.(*noneScope); ok { policyName = rawScope.policy.Name() } if policyName != tc.expectedPolicy { t.Errorf("Unexpected policy name. Have: %q wants %q", policyName, tc.expectedPolicy) </ins> } } }