Skip to content

Instantly share code, notes, and snippets.

@jianzzha
Created June 15, 2020 12:14
Show Gist options
  • Save jianzzha/db0442d51030a5060bd037d1f0420e63 to your computer and use it in GitHub Desktop.
Save jianzzha/db0442d51030a5060bd037d1f0420e63 to your computer and use it in GitHub Desktop.
uperf test
apiVersion: v1
kind: Pod
metadata:
name: uperf-master
spec:
restartPolicy: Never
#hostNetwork: true
containers:
- name: uperf-master
image: cscojianzhan/container-perf-tools
env:
- name: GIT_URL
value: https://github.com/jianzzha/container-tools.git
- name: tool
value: uperf
- name: mode
value: master
- name: uperfSlave
value: $slave
- name: size
value: "1024"
- name: threads
value: "1"
securityContext:
privileged: true
nodeSelector:
kubernetes.io/hostname: "worker0"
apiVersion: v1
kind: Pod
metadata:
name: uperf-slave
spec:
restartPolicy: Never
#hostNetwork: true
containers:
- name: uperf-slave
image: cscojianzhan/container-perf-tools
ports:
- containerPort: 20000
env:
- name: GIT_URL
value: https://github.com/jianzzha/container-tools.git
- name: tool
value: uperf
- name: mode
value: slave
securityContext:
privileged: true
nodeSelector:
kubernetes.io/hostname: "worker1"
#!/usr/bin/bash
if ! oc get pod uperf-slave 1>&2 2>/dev/null; then
oc create -f pod-uperf-slave.yaml
fi
oc delete pod uperf-master 2>/dev/null
while true; do
status=$(oc get pods uperf-slave -o json | jq -r '.status.phase')
if [[ "${status}" == "Running" ]]; then
break
fi
sleep 5s
done
export slave=$(oc get pods uperf-slave -o json | jq -r '.status.podIP')
envsubst < pod-uperf-master.yaml | oc create -f -
https://github.com/jianzzha/container-tools/tree/master/uperf
when sriov is enabled, the pod will have multiple interfaces, to select the sriov interface for the test, you may want to
change the test script to identify the sriov ip address used by the uperf slave pod. Right now the slave pod default
ip address is used in the script: slave=$(oc get pods uperf-slave -o json | jq -r '.status.podIP')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment