Skip to content

Commit 9370d33

Browse files
committed
deploy: wait until pods are up
This is useful because the caller then can be sure that the driver installation has succeeded, without having to know details about the pods that belong to the driver.
1 parent a6c8db9 commit 9370d33

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

deploy/deploy-hostpath.sh

+17
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,20 @@ for i in ${BASE_DIR}/hostpath/*.yaml; do
114114
done | kubectl apply -f -
115115
done
116116

117+
# Wait until all pods are running. We have to make some assumptions
118+
# about the deployment here, otherwise we wouldn't know what to wait
119+
# for: the expectation is that we run attacher, provisioner,
120+
# snapshotter and hostpath plugin in the default namespace.
121+
cnt=0
122+
while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) -lt 4 ]; do
123+
if [ $cnt -gt 30 ]; then
124+
echo "Running pods:"
125+
kubectl describe pods
126+
127+
echo >&2 "ERROR: hostpath deployment not ready after over 5min"
128+
exit 1
129+
fi
130+
echo $(date +%H:%M:%S) "waiting for hostpath deployment to complete, attempt #$cnt"
131+
cnt=$(($cnt + 1))
132+
sleep 10
133+
done

0 commit comments

Comments
 (0)