Skip to content

Commit 6b91f12

Browse files
authored
Delete the container forcely (#1314)
Signed-off-by: clyang82 <[email protected]>
1 parent 249849e commit 6b91f12

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

test/script/e2e_setup.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ start=$(date +%s)
1818
# Init clusters
1919
start_time=$(date +%s)
2020

21-
kind_cluster "$GH_NAME" 2>&1 &
21+
kind_cluster "$GH_NAME"
2222
for i in $(seq 1 "${MH_NUM}"); do
23-
kind_cluster "hub$i" 2>&1 &
23+
kind_cluster "hub$i"
2424
done
2525

26-
wait
2726
echo -e "${YELLOW} creating clusters:${NC} $(($(date +%s) - start_time)) seconds"
2827

2928
# service-ca

test/script/util.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,16 @@ kind_cluster() {
108108
dir="${CONFIG_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
109109
local cluster_name="$1"
110110
local kubeconfig="$dir/$cluster_name"
111-
while [ ! -f "$kubeconfig" ] || ! kubectl config get-contexts -o name | grep -wq "$cluster_name"; do
111+
local max_retries=5
112+
local counter=0
113+
while [ $counter -lt $max_retries ] && ( [ ! -f "$kubeconfig" ] || ! kubectl config get-contexts -o name | grep -wq "$cluster_name" ); do
112114
ensure_cluster "$cluster_name" "$kubeconfig"
115+
counter=$((counter + 1))
113116
done
117+
if [ $counter -eq $max_retries ]; then
118+
echo "Failed to create cluster $cluster_name"
119+
exit 1
120+
fi
114121
echo "kind clusters: $(kind get clusters)"
115122
}
116123

@@ -123,6 +130,7 @@ ensure_cluster() {
123130

124131
if kind get clusters | grep -q "^$cluster_name$"; then
125132
kind delete cluster --name="$cluster_name"
133+
docker rm -f "$cluster_name-control-plane"
126134
fi
127135

128136
kind create cluster --name "$cluster_name" --image=kindest/node:v1.23.0 --wait 5m

0 commit comments

Comments
 (0)