You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
59 lines
1.2 KiB
4 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
cd $(dirname $0)
|
||
|
|
||
|
## <setup>
|
||
|
|
||
4 years ago
|
kubectl create -f iperf2.yaml
|
||
4 years ago
|
|
||
4 years ago
|
until $(kubectl get pods -l app=iperf2-server -o jsonpath='{.items[0].status.containerStatuses[0].ready}'); do
|
||
|
echo "Waiting for iperf2 server to start..."
|
||
4 years ago
|
sleep 5
|
||
|
done
|
||
|
|
||
|
echo "Server is running"
|
||
|
echo
|
||
|
|
||
4 years ago
|
CLIENTS=$(kubectl get pods -l app=iperf2-client -o name | cut -d'/' -f2)
|
||
4 years ago
|
|
||
|
for POD in ${CLIENTS}; do
|
||
|
until $(kubectl get pod "${POD}" -o jsonpath='{.status.containerStatuses[0].ready}'); do
|
||
|
echo "Waiting for ${POD} to start..."
|
||
|
sleep 5
|
||
|
done
|
||
|
done
|
||
|
|
||
|
echo "All clients are running"
|
||
|
echo
|
||
|
|
||
|
kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName,IP-NODE:.status.hostIP,IP-POD:status.podIP
|
||
|
|
||
|
echo
|
||
|
|
||
|
## </setup>
|
||
|
## <run>
|
||
|
|
||
4 years ago
|
CLIENTS=$(kubectl get pods -l app=iperf2-client -o name | cut -d'/' -f2)
|
||
4 years ago
|
|
||
|
echo "Now all clients flood the server at the same time..."
|
||
|
|
||
|
for POD in ${CLIENTS}; do
|
||
4 years ago
|
echo "[Run] iperf2-client pod ${POD}"
|
||
|
kubectl exec -it "${POD}" -- iperf -c iperf2-server "$@" &> /dev/null &
|
||
4 years ago
|
done
|
||
|
|
||
|
until [[ $(jobs | grep -v Running) != "" ]]; do
|
||
|
printf "."
|
||
|
sleep 2
|
||
|
done
|
||
|
printf " done\n"
|
||
|
|
||
|
## </run>
|
||
|
## <clean>
|
||
|
|
||
4 years ago
|
kubectl delete --cascade -f iperf2.yaml
|
||
4 years ago
|
|
||
|
## </clean>
|