From 4e37897dd9595729962cfcbcc924b00d10ddea09 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 14 Nov 2020 22:29:22 +0100 Subject: [PATCH] Use correct interface for netStatus CNI plugins can return multiple interfaces, eg the bridge plugin. We need the interface with the sandbox. --- client/allocrunner/networking_cni.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/allocrunner/networking_cni.go b/client/allocrunner/networking_cni.go index 73d8a24a4..795806f81 100644 --- a/client/allocrunner/networking_cni.go +++ b/client/allocrunner/networking_cni.go @@ -112,7 +112,9 @@ 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 { - return r.Interfaces[i], i + if r.Interfaces[i].Sandbox != "" { + return r.Interfaces[i], i + } } return nil, "" }(res)