-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare-demo1.sh
executable file
·33 lines (25 loc) · 1.04 KB
/
prepare-demo1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Get the directory of the current script
SCRIPT_DIR=$(dirname "$0")
# Destroy the single kind cluster
"$SCRIPT_DIR/destroy-kind.sh" 1
# Create 1 kind clusters
"$SCRIPT_DIR/create-kind-clusters.sh" 1
DEPLOYMENT_NAME="coredns"
NAMESPACE="kube-system"
while true; do
# Check if the deployment is ready
READY_REPLICAS=$(kubectl --context kind-dns-0 get deployment $DEPLOYMENT_NAME -n $NAMESPACE -o jsonpath='{.status.readyReplicas}')
DESIRED_REPLICAS=$(kubectl --context kind-dns-0 get deployment $DEPLOYMENT_NAME -n $NAMESPACE -o jsonpath='{.status.replicas}')
if [[ "$READY_REPLICAS" == "$DESIRED_REPLICAS" ]] && [[ "$READY_REPLICAS" -gt 0 ]]; then
echo "Deployment $DEPLOYMENT_NAME is ready."
break
else
echo "Waiting... Ready replicas: $READY_REPLICAS / $DESIRED_REPLICAS"
sleep 5
fi
done
"$SCRIPT_DIR/setup-kind.sh" 0
# Remove the coredns debloyment in dns namespace for first demo
helm uninstall --namespace dns --kube-context kind-dns-0 coredns
# kubectl --context kind-dns-0 delete deployment coredns -n dns