From 03f5b5e5b820eab56bc1b8e24e30686588145af5 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Wed, 2 Dec 2020 14:01:14 +0100 Subject: [PATCH] Minor fix --- .gitignore | 2 ++ iperf2.yaml | 3 +-- iperf3-k8s.sh | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .gitignore 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