From be11db45d8b45b98301dfa152dbf86617c94a919 Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Thu, 4 May 2017 15:49:56 +0100 Subject: [PATCH] Ignore error when deleting a container's interface. Fixes #2921, as all errors are now ignored, including `ENOENT`. This command typically attempts to delete the network interface `eth0` of a container being destroyed by Kubernetes. If this interface has already been destroyed or is missing for whatever reason, we still want to remove this container's entry from IPAM in order to free associated resources. --- plugin/net/cni.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/net/cni.go b/plugin/net/cni.go index b8439584..8265bf45 100644 --- a/plugin/net/cni.go +++ b/plugin/net/cni.go @@ -195,8 +195,8 @@ func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error { // As of CNI 0.3 spec, runtimes can send blank if they just want the address deallocated if args.Netns != "" { if _, err = weavenet.WithNetNS(args.Netns, "del-iface", args.IfName); err != nil { + // We log the error and carry on instead of returning nil, as there may still be resources to free in IPAM. logOnStderr(fmt.Errorf("error removing interface %q: %s", args.IfName, err)) - return nil } }