From 877602d6276eaabac480f589deccb41b2faccb20 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Sun, 12 Jul 2020 23:49:02 +0200 Subject: [PATCH] portmap DEL noop if no portMappings present if the runtime is not passing portMappings in the runtimeConfig, then DEL is a noop. This solves performance issues, when the portmap plugin is executed multiple times, holding the iptables lock, despite it does not have anything to delete. Signed-off-by: Antonio Ojea --- plugins/meta/portmap/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/meta/portmap/main.go b/plugins/meta/portmap/main.go index 4743a3702..9d1559162 100644 --- a/plugins/meta/portmap/main.go +++ b/plugins/meta/portmap/main.go @@ -107,6 +107,10 @@ func cmdDel(args *skel.CmdArgs) error { return fmt.Errorf("failed to parse config: %v", err) } + if len(netConf.RuntimeConfig.PortMaps) == 0 { + return nil + } + netConf.ContainerID = args.ContainerID // We don't need to parse out whether or not we're using v6 or snat,