#!/bin/sh # ---- # File: cilium-remove.sh # Description: Tool to remove k8s cilium test clusters using k3d or kind # Author: Sergio Talens-Oliag # Copyright: (c) 2023 Sergio Talens-Oliag # ---- set -e # --------- # VARIABLES # --------- K3D_NETWORK_NAME="cilium" KIND_NETWORK_NAME="kind" # --------- # FUNCTIONS # --------- delete_network() { NETWORK_ID="$( docker network inspect "$NETWORK_NAME" --format "{{.Id}}" 2>/dev/null )" || true if [ "$NETWORK_ID" ]; then echo "Removing network '$NETWORK_NAME' with id '$NETWORK_ID'" docker network rm "$NETWORK_NAME" else echo "Network '$NETWORK_NAME' not found in docker" fi } delete_cluster() { case "$CTOOL" in k3d) echo "Deleting k3d cluster '$CNAME'" k3d cluster delete "$CNAME" ;; kind) echo "Deleting kind cluster '$CNAME'" kind delete cluster -n "$CNAME" ;; esac } usage() { cat <