Skip to content

Commit 3fb8dfb

Browse files
committed
deploy: more helpful output when kubectl fails
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.
1 parent d4c7cdb commit 3fb8dfb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

deploy/kubernetes-1.13/deploy-hostpath.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ done
111111
echo "deploying hostpath components"
112112
for i in ${BASE_DIR}/hostpath/*.yaml; do
113113
echo " $i"
114-
cat "$i" | while IFS= read -r line; do
114+
modified="$(cat "$i" | while IFS= read -r line; do
115115
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
116116
if echo "$nocomments" | grep -q '^\s*image:\s*'; then
117117
# Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1'
@@ -135,7 +135,12 @@ for i in ${BASE_DIR}/hostpath/*.yaml; do
135135
echo " using $line" >&2
136136
fi
137137
echo "$line"
138-
done | kubectl apply -f -
138+
done)"
139+
if ! echo "$modified" | kubectl apply -f -; then
140+
echo "modified version of $i:"
141+
echo "$modified"
142+
exit 1
143+
fi
139144
done
140145
141146
# Wait until all pods are running. We have to make some assumptions

0 commit comments

Comments
 (0)