diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f40e633 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.json +*.csv diff --git a/iperf2.yaml b/iperf2.yaml index f7a4b62..76b9ae9 100644 --- a/iperf2.yaml +++ b/iperf2.yaml @@ -63,13 +63,12 @@ spec: --- apiVersion: apps/v1 -kind: ReplicaSet +kind: DaemonSet metadata: name: iperf2-clients labels: app: iperf2-client spec: - replicas: 18 selector: matchLabels: app: iperf2-client diff --git a/iperf3-k8s.sh b/iperf3-k8s.sh index 7d614c7..67b1a29 100755 --- a/iperf3-k8s.sh +++ b/iperf3-k8s.sh @@ -37,9 +37,17 @@ echo CLIENTS=$(kubectl get pods -l app=iperf3-client -o name | cut -d'/' -f2) +arguments="$*" + +timestamp="$(date +"%Y-%m-%d_%H-%M-%S")" + for POD in ${CLIENTS}; do HOST=$(kubectl get pod "${POD}" -o jsonpath='{.status.hostIP}') - kubectl exec -it "${POD}" -- iperf3 -c iperf3-server -T "Client on ${HOST}" "$@" + if [[ "${arguments}" == *"-J"* ]]; then + kubectl exec -it "${POD}" -- iperf3 -c iperf3-server -T "${HOST}" "$@" > "reports/${timestamp}-${HOST}-${POD}.json" + else + kubectl exec -it "${POD}" -- iperf3 -c iperf3-server -T "${HOST}" "$@" + fi echo done