From 931e8aa7ccabd9d88b6a5d024531ad8615aacd79 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 c0675b582..1e0d692ff 100755 --- a/deploy/kubernetes-1.13/deploy-hostpath.sh +++ b/deploy/kubernetes-1.13/deploy-hostpath.sh @@ -111,7 +111,7 @@ done echo "deploying hostpath components" for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do echo " $i" - cat "$i" | while IFS= read -r line; do + modified="$(cat "$i" | while IFS= read -r line; do nocomments="$(echo "$line" | sed -e 's/ *#.*$//')" if echo "$nocomments" | grep -q '^\s*image:\s*'; then # Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1' @@ -135,7 +135,12 @@ for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); 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