Use correct interface for netStatus

CNI plugins can return multiple interfaces, eg the bridge plugin.
We need the interface with the sandbox.
This commit is contained in:
Wim 2020-11-14 22:29:22 +01:00
parent 8df5f28dc3
commit 4e37897dd9

View file

@ -112,8 +112,10 @@ func (c *cniNetworkConfigurator) Setup(ctx context.Context, alloc *structs.Alloc
if len(res.Interfaces) > 0 {
iface, name := func(r *cni.CNIResult) (*cni.Config, string) {
for i := range r.Interfaces {
if r.Interfaces[i].Sandbox != "" {
return r.Interfaces[i], i
}
}
return nil, ""
}(res)