Skip to content

Commit

Permalink
UDP Service LB examples and scripts update (#155)
Browse files Browse the repository at this point in the history
* Adding examples for udp service LB

Signed-off-by: Sharanakumar <[email protected]>

* scripts update - copy json files to ACC with split mode

Signed-off-by: Sharanakumar <[email protected]>

* README update

Signed-off-by: Sharanakumar <[email protected]>

---------

Signed-off-by: Sharanakumar <[email protected]>
  • Loading branch information
sharanakumarpatil authored Nov 30, 2023
1 parent ef5972d commit 1157005
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 5 deletions.
12 changes: 8 additions & 4 deletions example/service/README.md → example/service/tcp/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
## Details
This directory includes a service manifest file and a script to run the tests.
- iperf_tcp.yaml
- This file has the manifests to create an iperf server and a client.
- The iperf server is started as a service with two backend endpoints and
- This file has the manifests to create an iperf tcp server and a client.
- The iperf server is started as a tcp service with two backend endpoints and
the iperf client is started as a daemonset.
- run.sh
- Script to run the test. The script sends 100 client requests to the iperf server.
- Script to run the test. The script sends 100 client tcp requests to the iperf server.
- clean_up.sh
- Script to delete the server and client pods.

## How to Run
- Create the iperf server and client
- # kubectl create -f iperf_tcp.yaml
- Run the tests
- # ./run.sh <client-pod-name>
- # ./run.sh \<client-pod-name\>
- Delete iperf server and client pods
- # ./clean_up.sh

## iperf docker image details
- https://github.com/lroktu/iperf
- https://hub.docker.com/r/lroktu/iperf
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions example/service/udp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Details
This directory includes a service manifest file and a script to run the tests.
- iperf_udp.yaml
- This file has the manifests to create an iperf udp server and a client.
- The iperf server is started as a udp service with two backend endpoints and
the iperf client is started as a daemonset.
- run.sh
- Script to run the test. The script sends 100 client udp requests to the iperf server.
- clean_up.sh
- Script to delete the server and client pods.

## How to Run
- Create the iperf server and client
- # kubectl create -f iperf_udp.yaml
- Run the tests
- # ./run.sh \<client-pod-name\>
- Delete iperf server and client pods
- # ./clean_up.sh

## iperf docker image details
- https://github.com/lroktu/iperf
- https://hub.docker.com/r/lroktu/iperf
4 changes: 4 additions & 0 deletions example/service/udp/clean_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eu

kubectl delete --cascade -f iperf_udp.yaml
81 changes: 81 additions & 0 deletions example/service/udp/iperf_udp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf-server-deployment-udp
labels:
app: iperf-server-udp
spec:
replicas: 2
selector:
matchLabels:
app: iperf-server-udp
template:
metadata:
labels:
app: iperf-server-udp
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: kubernetes.io/role
operator: In
values:
- master
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: iperf-server-udp
image: lroktu/iperf
args: ['-s', '-u', '-p', '5202']
command: [iperf]
ports:
- containerPort: 5202
name: server
protocol: UDP
terminationGracePeriodSeconds: 0

---

apiVersion: v1
kind: Service
metadata:
name: iperf-server-udp
spec:
selector:
app: iperf-server-udp
ports:
- protocol: UDP
port: 5202
targetPort: server

---

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: iperf-client
labels:
app: iperf-client
spec:
selector:
matchLabels:
app: iperf-client
template:
metadata:
labels:
app: iperf-client
spec:
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: iperf-client
image: lroktu/iperf
command: ['/bin/sh', '-c', 'sleep infinity']
terminationGracePeriodSeconds: 0
14 changes: 14 additions & 0 deletions example/service/udp/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Error: Missing argument. Please provide client pod name as command line argument."
exit 1
fi

CLIENT="$1"

# Loop 100 times
for i in {1..100}; do
echo "This is iteration $i"
kubectl exec "$CLIENT" -- iperf -c iperf-server-udp -u -p 5202 -t 2
done
4 changes: 4 additions & 0 deletions scripts/es2k/setup_infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ function copy_config_to_remote() {
echo "Error: Missing InfraManager config file."
exit 1
fi
launch_on_remote "mkdir -p /share/infra/jsonfiles" ""
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $BASE_DIR/pkg/inframanager/p4/*.json $REMOTE_HOST:/share/infra/jsonfiles/.
check_status $? "scp $BASE_DIR/pkg/inframanager/p4/*.json root@$REMOTE_HOST:/share/infra/jsonfiles"
}
# Copy remote execution script to arm acc
Expand Down
2 changes: 1 addition & 1 deletion scripts/es2k/setup_infra_sriov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function install_drivers () {
sleep 1
# change this with insmod in case of new idpf host driver
dev_id=$(lspci | grep 1452 | cut -d ':' -f 1)
echo $1 > /sys/class/pci_bus/0000:af/device/0000:$dev_id:00.0/sriov_numvfs
echo $1 > /sys/class/pci_bus/0000:$dev_id/device/0000:$dev_id:00.0/sriov_numvfs
#sriov vf devices take a long time to come up
sleep 10
}
Expand Down

0 comments on commit 1157005

Please sign in to comment.