Skip to content

Commit ef36e61

Browse files
klihubmikebrow
authored andcommitted
cri,nri: pass any linux net devices to plugins.
Signed-off-by: Krisztian Litkey <[email protected]>
1 parent d56faf4 commit ef36e61

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

internal/cri/nri/nri_api_linux.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,13 @@ func (c *criContainer) GetScheduler() *api.LinuxScheduler {
882882
return api.FromOCILinuxScheduler(c.spec.Process.Scheduler)
883883
}
884884

885+
func (c *criContainer) GetNetDevices() map[string]*api.LinuxNetDevice {
886+
if c.spec.Linux == nil {
887+
return nil
888+
}
889+
return api.FromOCILinuxNetDevices(c.spec.Linux.NetDevices)
890+
}
891+
885892
func (c *criContainer) GetPid() uint32 {
886893
return c.pid
887894
}

internal/nri/container.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type LinuxContainer interface {
4747
GetCgroupsPath() string
4848
GetIOPriority() *nri.LinuxIOPriority
4949
GetScheduler() *nri.LinuxScheduler
50+
GetNetDevices() map[string]*nri.LinuxNetDevice
5051
}
5152

5253
func commonContainerToNRI(ctr Container) *nri.Container {

internal/nri/container_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func containerToNRI(ctr Container) *nri.Container {
3333
CgroupsPath: lnxCtr.GetCgroupsPath(),
3434
IoPriority: lnxCtr.GetIOPriority(),
3535
Scheduler: lnxCtr.GetScheduler(),
36+
NetDevices: lnxCtr.GetNetDevices(),
3637
}
3738
return nriCtr
3839
}

0 commit comments

Comments
 (0)