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.
This commit is contained in:
1 parent
30213bd71e
commit
be11db45d8
1 file changed
+1
-1
+1
-1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user