From d3ee1b3536ebe7ea3083879b49abf322d52eed99 Mon Sep 17 00:00:00 2001 From: Federico Paolinelli Date: Thu, 25 Jan 2024 10:46:28 +0100 Subject: [PATCH] dev-env: don't create extra_network if it already exists When we destroy the cluster with kind delete cluster, the network2 network remains dangling and a sequent inv dev-env command will fail to create it. Here we don't create if it exists already. Signed-off-by: Federico Paolinelli --- tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 62a3a860839..32ce47695ec 100644 --- a/tasks.py +++ b/tasks.py @@ -139,7 +139,8 @@ def _get_subnets_allocated_ips(): def _add_nic_to_nodes(cluster_name): nodes = run("kind get nodes --name {name}".format(name=cluster_name)).stdout.strip().split("\n") - run("docker network create --ipv6 --subnet {ipv6_subnet} -d bridge {bridge_name}".format(bridge_name=extra_network, ipv6_subnet="fc00:f853:ccd:e791::/64")) + if not _is_network_exist(extra_network): + run("docker network create --ipv6 --subnet {ipv6_subnet} -d bridge {bridge_name}".format(bridge_name=extra_network, ipv6_subnet="fc00:f853:ccd:e791::/64")) for node in nodes: run("docker network connect {bridge_name} {node}".format(bridge_name=extra_network, node=node))