Skip to content

Commit

Permalink
dev-env: don't create extra_network if it already exists
Browse files Browse the repository at this point in the history
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 <fpaoline@redhat.com>
  • Loading branch information
fedepaol committed Jan 26, 2024
1 parent 52caca0 commit e8741e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tasks.py
Expand Up @@ -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))

Expand Down

0 comments on commit e8741e0

Please sign in to comment.