Skip to content

Commit 9165f7b

Browse files
authored
Merge pull request kubernetes#82104 from klueska/upstream-fix-cpu-manager-topology-bug
Fix bug in CPUManager with setting topology for policies
2 parents d3063c6 + ddfd9ac commit 9165f7b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/kubelet/cm/cpumanager/cpu_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo
113113

114114
case PolicyStatic:
115115
var err error
116-
topo, err := topology.Discover(machineInfo, numaNodeInfo)
116+
topo, err = topology.Discover(machineInfo, numaNodeInfo)
117117
if err != nil {
118118
return nil, err
119119
}

pkg/kubelet/cm/cpumanager/cpu_manager_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,16 @@ func TestCPUManagerGenerate(t *testing.T) {
353353
if rawMgr.policy.Name() != testCase.expectedPolicy {
354354
t.Errorf("Unexpected policy name. Have: %q wants %q", rawMgr.policy.Name(), testCase.expectedPolicy)
355355
}
356+
if rawMgr.policy.Name() == string(PolicyNone) {
357+
if rawMgr.topology != nil {
358+
t.Errorf("Expected topology to be nil for 'none' policy. Have: %q", rawMgr.topology)
359+
}
360+
}
361+
if rawMgr.policy.Name() != string(PolicyNone) {
362+
if rawMgr.topology == nil {
363+
t.Errorf("Expected topology to be non-nil for policy '%v'. Have: %q", rawMgr.policy.Name(), rawMgr.topology)
364+
}
365+
}
356366
}
357367
})
358368

0 commit comments

Comments
 (0)