File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,11 @@ start=$(date +%s)
18
18
# Init clusters
19
19
start_time=$( date +%s)
20
20
21
- kind_cluster " $GH_NAME " 2>&1 &
21
+ kind_cluster " $GH_NAME "
22
22
for i in $( seq 1 " ${MH_NUM} " ) ; do
23
- kind_cluster " hub$i " 2>&1 &
23
+ kind_cluster " hub$i "
24
24
done
25
25
26
- wait
27
26
echo -e " ${YELLOW} creating clusters:${NC} $(( $(date +% s) - start_time)) seconds"
28
27
29
28
# service-ca
Original file line number Diff line number Diff line change @@ -108,9 +108,16 @@ kind_cluster() {
108
108
dir=" ${CONFIG_DIR:- $(cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)} "
109
109
local cluster_name=" $1 "
110
110
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
112
114
ensure_cluster " $cluster_name " " $kubeconfig "
115
+ counter=$(( counter + 1 ))
113
116
done
117
+ if [ $counter -eq $max_retries ]; then
118
+ echo " Failed to create cluster $cluster_name "
119
+ exit 1
120
+ fi
114
121
echo " kind clusters: $( kind get clusters) "
115
122
}
116
123
@@ -123,6 +130,7 @@ ensure_cluster() {
123
130
124
131
if kind get clusters | grep -q " ^$cluster_name $" ; then
125
132
kind delete cluster --name=" $cluster_name "
133
+ docker rm -f " $cluster_name -control-plane"
126
134
fi
127
135
128
136
kind create cluster --name " $cluster_name " --image=kindest/node:v1.23.0 --wait 5m
You can’t perform that action at this time.
0 commit comments