Skip to content

Commit 556d944

Browse files
committed
deploy: better diagnostics when driver deployment fails
With the recently introduced labels it becomes possible to describe all objects that make up the driver deployment. This might be a lot of output, but as this typically runs in a CI environment, it is better to print too much than to little information because retrieving more information later isn't possible. Now also the logs of all containers are printed.
1 parent b2c1053 commit 556d944

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

deploy/kubernetes-distributed/deploy.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,18 @@ wait_for_daemonset () {
250250
251251
# Wait until the DaemonSet is running on all nodes.
252252
if ! wait_for_daemonset default csi-hostpathplugin; then
253+
echo
253254
echo "driver not ready"
254-
kubectl describe daemonsets/csi-hostpathplugin
255+
echo "Deployment:"
256+
(set +e; set -x; kubectl describe all,role,clusterrole,rolebinding,clusterrolebinding,serviceaccount,storageclass,csidriver --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io)
257+
echo
258+
echo "Pod logs:"
259+
kubectl get pods -l app.kubernetes.io/instance=hostpath.csi.k8s.io --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{" "}{range .spec.containers[*]}{.name}{" "}{end}{end}' | while read -r pod containers; do
260+
for c in $containers; do
261+
echo
262+
(set +e; set -x; kubectl logs $pod $c)
263+
done
264+
done
255265
exit 1
256266
fi
257267

deploy/util/deploy-hostpath.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,19 @@ expected_running_pods=6
247247
cnt=0
248248
while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) -lt ${expected_running_pods} ]; do
249249
if [ $cnt -gt 30 ]; then
250-
echo "$(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) running pods:"
251-
kubectl describe pods
252-
253-
echo >&2 "ERROR: hostpath deployment not ready after over 5min"
250+
echo "Expecting $expected_running_pods, have $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l)."
251+
echo "Deployment:"
252+
(set +e; set -x; kubectl describe all,role,clusterrole,rolebinding,clusterrolebinding,serviceaccount,storageclass,csidriver --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io)
253+
echo
254+
echo "Pod logs:"
255+
kubectl get pods -l app.kubernetes.io/instance=hostpath.csi.k8s.io --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{" "}{range .spec.containers[*]}{.name}{" "}{end}{end}' | while read -r pod containers; do
256+
for c in $containers; do
257+
echo
258+
(set +e; set -x; kubectl logs $pod $c)
259+
done
260+
done
261+
echo
262+
echo "ERROR: hostpath deployment not ready after over 5min"
254263
exit 1
255264
fi
256265
echo $(date +%H:%M:%S) "waiting for hostpath deployment to complete, attempt #$cnt"

0 commit comments

Comments
 (0)