mirror of
https://github.com/logos-storage/bittorrent-benchmarks.git
synced 2026-02-26 23:53:08 +00:00
add first working k8s experiment
This commit is contained in:
parent
4e2e091c75
commit
ec466c50c6
18
k8s/deluge-service.yaml
Normal file
18
k8s/deluge-service.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: deluge-service
|
||||
namespace: codex-benchmarks
|
||||
labels:
|
||||
app: deluge-nodes
|
||||
spec:
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: deluge-nodes
|
||||
ports:
|
||||
- port: 6890
|
||||
name: rpc
|
||||
- port: 6891
|
||||
name: listen-1
|
||||
- port: 6892
|
||||
name: listen-2
|
||||
@ -35,7 +35,12 @@ spec:
|
||||
command: [ "/bin/bash", "--login", "-c" ]
|
||||
args:
|
||||
- |
|
||||
# Sadly we can't mount a subpath, so need add the correct prefix
|
||||
# into all of the config directories.
|
||||
export DELUGE_CONFIG_DIR=/var/lib/deluge/${CLIENT_POD_NAME}
|
||||
export DELUGE_DOWNLOAD_DIR=${DELUGE_CONFIG_DIR}/downloads
|
||||
export DELUGE_TORRENTFILE_DIR=${DELUGE_CONFIG_DIR}/downloads
|
||||
export DELUGE_PLUGINS_DIR=${DELUGE_CONFIG_DIR}/plugins
|
||||
|
||||
# Makes sure there's no previous garbage in there.
|
||||
rm -rf ${DELUGE_CONFIG_DIR}
|
||||
|
||||
7
k8s/deploy-order.txt
Normal file
7
k8s/deploy-order.txt
Normal file
@ -0,0 +1,7 @@
|
||||
namespace.yaml
|
||||
deluge-pvc.yaml
|
||||
deluge-service.yaml
|
||||
tracker-deployment.yaml
|
||||
tracker-service.yaml
|
||||
deluge-statefulset.yaml
|
||||
testrunner-job.yaml
|
||||
33
k8s/run.sh
Executable file
33
k8s/run.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
function on_interrupt () {
|
||||
read -p "CTRL+C pressed. Do you want to stop the test runner as well? [y/N] " -n 1 -r
|
||||
echo ""
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Deleting experiment namespace..."
|
||||
kubectl delete namespace codex-benchmarks
|
||||
fi
|
||||
}
|
||||
|
||||
trap on_interrupt INT
|
||||
|
||||
echo " * Clearing previous deployments"
|
||||
kubectl delete namespace codex-benchmarks || true
|
||||
|
||||
echo " * Deploying manifests"
|
||||
while read -r resource; do
|
||||
kubectl apply -f "${resource}"
|
||||
done < deploy-order.txt
|
||||
|
||||
echo " * Awaiting for test runner to start"
|
||||
kubectl wait --for=condition=Ready --selector=app=testrunner pod -n codex-benchmarks --timeout=30s
|
||||
|
||||
echo " * Attaching to test runner logs"
|
||||
TESTRUNNER_POD=$(kubectl get pods -n codex-benchmarks -l app=testrunner -o jsonpath="{.items[0].metadata.name}")
|
||||
if [ -z "${TESTRUNNER_POD}" ]; then
|
||||
echo "Testrunner pod not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kubectl logs -f "${TESTRUNNER_POD}" -n codex-benchmarks
|
||||
55
k8s/testrunner-job.yaml
Normal file
55
k8s/testrunner-job.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: testrunner
|
||||
namespace: codex-benchmarks
|
||||
labels:
|
||||
app: testrunner
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: testrunner
|
||||
spec:
|
||||
containers:
|
||||
- name: testrunner
|
||||
image: codexstorage/bittorrent-benchmarks:latest
|
||||
imagePullPolicy: Always
|
||||
args: [ "run", "deluge_experiment" ]
|
||||
env:
|
||||
- name: NETWORK_SIZE
|
||||
value: "5"
|
||||
- name: SEEDERS
|
||||
value: "1"
|
||||
- name: REPETITIONS
|
||||
value: "1"
|
||||
- name: FILE_SIZE
|
||||
value: "52428800"
|
||||
- name: TRACKER_ANNOUNCE_URL
|
||||
value: "http://tracker-service.codex-benchmarks.svc.cluster.local:8000/announce"
|
||||
- name: SHARED_VOLUME_PATH
|
||||
value: "/opt/bittorrent-benchmarks/volume"
|
||||
- name: DELUGE_STATEFULSET
|
||||
value: "deluge-nodes"
|
||||
- name: DELUGE_SERVICE
|
||||
value: "deluge-service"
|
||||
- name: NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
volumeMounts:
|
||||
- name: benchmark-volume
|
||||
mountPath: /opt/bittorrent-benchmarks/volume
|
||||
resources:
|
||||
requests:
|
||||
cpu: "1"
|
||||
memory: "2Gi"
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: "2Gi"
|
||||
volumes:
|
||||
- name: benchmark-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: deluge-pvc
|
||||
restartPolicy: Never
|
||||
backoffLimit: 0
|
||||
@ -12,4 +12,4 @@ spec:
|
||||
targetPort: 8000
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: tracker
|
||||
app: bittorrent-tracker
|
||||
Loading…
x
Reference in New Issue
Block a user