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 <aojea@redhat.com>
This commit is contained in:
Antonio Ojea 2020-07-12 23:49:02 +02:00
parent c90b165c6e
commit 877602d627

View File

@ -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,