Skip to content

Commit

Permalink
deploy: more helpful output when kubectl fails
Browse files Browse the repository at this point in the history
While debugging for PR kubernetes-csi#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.
  • Loading branch information
pohly committed Apr 1, 2019
1 parent 1d8a018 commit 931e8aa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deploy/kubernetes-1.13/deploy-hostpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down

0 comments on commit 931e8aa

Please sign in to comment.