From 901f274b1adaf44a1c9b46f9e4dcab627cf67c28 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 8 Mar 2019 19:51:31 +0100 Subject: [PATCH] deploy: more helpful output when kubectl fails While debugging for PR #26 it was useful to see the actual input that was sent to kubectl. It's still not perfect, but that's because line numbers by kubectl refer to individual items, not the entire input, but at least it's something. --- deploy/kubernetes-1.13/deploy-hostpath.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/kubernetes-1.13/deploy-hostpath.sh b/deploy/kubernetes-1.13/deploy-hostpath.sh index 5081fd5c6..bfd1338d1 100755 --- a/deploy/kubernetes-1.13/deploy-hostpath.sh +++ b/deploy/kubernetes-1.13/deploy-hostpath.sh @@ -88,7 +88,7 @@ run kubectl apply -f "${CSI_SNAPSHOTTER_RBAC}" echo "deploying hostpath components" for i in ${BASE_DIR}/hostpath/*.yaml; do echo " $i" - cat "$i" | while IFS= read -r line; do + modified="$(cat "$i" | while IFS= read -r line; do if echo "$line" | grep -q '^\s*image:\s*'; then # Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1' # into image (quay.io/k8scsi/csi-attacher:v1.0.1), @@ -111,7 +111,12 @@ for i in ${BASE_DIR}/hostpath/*.yaml; do echo " using $line" >&2 fi echo "$line" - done | kubectl apply -f - + done)" + if ! echo "$modified" | kubectl apply -f -; then + echo "modified version of $i:" + echo "$modified" + exit 1 + fi done # Wait until all pods are running. We have to make some assumptions