Skip to content

Commit 15697b9

Browse files
author
Néstor Salceda
committed
Use a smaller value for polling the pod for the capture
1 parent 20c23e7 commit 15697b9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

kubectl-capture

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,21 @@ EOF
148148
echo "Parameters for Sysdig: ${sysdig_params}"
149149
echo ""
150150

151-
sleep ${duration}
152-
while [[ ! -e .finished ]]; do
153-
kubectl cp ${capture_pod}:/.finished .finished > /dev/null 2>&1
154-
sleep 20
155-
done
156-
rm .finished
151+
wait_until_finished
157152

158153
kubectl cp ${capture_pod}:/${capture_pod}.scap.gz ${capture_pod}.scap.gz > /dev/null 2>&1
159154
kubectl delete pod ${capture_pod} > /dev/null 2>&1
160155
echo "The capture has been downloaded to your hard disk at:"
161156
echo "${PWD}/${capture_pod}.scap.gz"
162157
}
163158

159+
function wait_until_finished() {
160+
sleep ${duration}
161+
while [[ ! -e .finished ]]; do
162+
kubectl cp ${capture_pod}:/.finished .finished > /dev/null 2>&1
163+
sleep 15
164+
done
165+
rm .finished
166+
}
167+
164168
main "$@"

0 commit comments

Comments
 (0)