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 Mar 15, 2019
1 parent 821e0db commit 901f274
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 @@ -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),
Expand All @@ -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
Expand Down

0 comments on commit 901f274

Please sign in to comment.