mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
node: podresources: list devices without topology
It's legal for device plugins to not expose topology informations. Previously, the code was just skipping these devices. Review highlighted is better to report them anyway and let the client application decide if they still want somehow to track them or skip them entirely. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
parent
16d5ac3689
commit
da55ef0b9a
@ -194,15 +194,26 @@ func containerDevicesFromResourceDeviceInstances(devs devicemanager.ResourceDevi
|
||||
|
||||
for resourceName, resourceDevs := range devs {
|
||||
for devID, dev := range resourceDevs {
|
||||
for _, node := range dev.GetTopology().GetNodes() {
|
||||
numaNode := node.GetID()
|
||||
topo := dev.GetTopology()
|
||||
if topo == nil {
|
||||
// Some device plugin do not report the topology information.
|
||||
// This is legal, so we report the devices anyway,
|
||||
// let the client decide what to do.
|
||||
respDevs = append(respDevs, &podresourcesapi.ContainerDevices{
|
||||
ResourceName: resourceName,
|
||||
DeviceIds: []string{devID},
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
for _, node := range topo.GetNodes() {
|
||||
respDevs = append(respDevs, &podresourcesapi.ContainerDevices{
|
||||
ResourceName: resourceName,
|
||||
DeviceIds: []string{devID},
|
||||
Topology: &podresourcesapi.TopologyInfo{
|
||||
Nodes: []*podresourcesapi.NUMANode{
|
||||
{
|
||||
ID: numaNode,
|
||||
ID: node.GetID(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user