mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Single-numa-node Topology Manager bug fix
Added one off fix for single-numa-node policy to correctly reject pod admission on a resource allocation that spans NUMA nodes Co-authored-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
f6c085f60e
commit
8ad1b5ba3b
@ -231,6 +231,11 @@ func (m *manager) calculateAffinity(pod v1.Pod, container v1.Container) Topology
|
||||
if !hint.Preferred {
|
||||
preferred = false
|
||||
}
|
||||
// Special case PolicySingleNumaNode to only prefer hints where
|
||||
// all providers have a single NUMA affinity set.
|
||||
if m.policy != nil && m.policy.Name() == PolicySingleNumaNode && hint.NUMANodeAffinity.Count() > 1 {
|
||||
preferred = false
|
||||
}
|
||||
numaAffinities = append(numaAffinities, hint.NUMANodeAffinity)
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ func TestCalculateAffinity(t *testing.T) {
|
||||
name string
|
||||
hp []HintProvider
|
||||
expected TopologyHint
|
||||
policy Policy
|
||||
}{
|
||||
{
|
||||
name: "TopologyHint not set",
|
||||
@ -655,10 +656,45 @@ func TestCalculateAffinity(t *testing.T) {
|
||||
Preferred: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Special cased PolicySingleNumaNode for single NUMA hint generation",
|
||||
policy: NewSingleNumaNodePolicy(),
|
||||
hp: []HintProvider{
|
||||
&mockHintProvider{
|
||||
map[string][]TopologyHint{
|
||||
"resource1": {
|
||||
{
|
||||
NUMANodeAffinity: NewTestSocketMask(0, 1),
|
||||
Preferred: true,
|
||||
},
|
||||
},
|
||||
"resource2": {
|
||||
{
|
||||
NUMANodeAffinity: NewTestSocketMask(0),
|
||||
Preferred: true,
|
||||
},
|
||||
{
|
||||
NUMANodeAffinity: NewTestSocketMask(1),
|
||||
Preferred: true,
|
||||
},
|
||||
{
|
||||
NUMANodeAffinity: NewTestSocketMask(0, 1),
|
||||
Preferred: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: TopologyHint{
|
||||
NUMANodeAffinity: NewTestSocketMask(0),
|
||||
Preferred: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tcases {
|
||||
mngr := manager{
|
||||
policy: tc.policy,
|
||||
hintProviders: tc.hp,
|
||||
numaNodes: numaNodes,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user