From ac964c8e1dd0bae8bc20c7e8a15f581b09c9aad4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de>
Date: Sat, 26 Sep 2020 16:03:04 +0200
Subject: [PATCH] Enable theodolite script to run in kubernetes

---
 execution/.dockerignore   |  9 ++++++
 execution/Dockerfile      | 15 +++++++++
 execution/theodolite.yaml | 67 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 execution/.dockerignore
 create mode 100644 execution/Dockerfile
 create mode 100644 execution/theodolite.yaml

diff --git a/execution/.dockerignore b/execution/.dockerignore
new file mode 100644
index 000000000..68e5f21c5
--- /dev/null
+++ b/execution/.dockerignore
@@ -0,0 +1,9 @@
+*
+!requirements.txt
+!uc-workload-generator
+!uc-application
+!strategies
+!lib
+!theodolite.py
+!run_uc.py
+!lag_analysis.py
diff --git a/execution/Dockerfile b/execution/Dockerfile
new file mode 100644
index 000000000..e71bc91d9
--- /dev/null
+++ b/execution/Dockerfile
@@ -0,0 +1,15 @@
+FROM python:3.8
+
+RUN mkdir /app
+WORKDIR /app
+ADD requirements.txt /app/
+RUN pip install -r requirements.txt
+COPY uc-workload-generator /app/uc-workload-generator
+COPY uc-application /app/uc-application
+COPY strategies /app/strategies
+COPY lib /app/lib
+COPY lag_analysis.py /app/
+COPY run_uc.py /app/
+COPY theodolite.py /app/
+
+CMD ["python", "/app/theodolite.py"]
diff --git a/execution/theodolite.yaml b/execution/theodolite.yaml
new file mode 100644
index 000000000..e81c6ba13
--- /dev/null
+++ b/execution/theodolite.yaml
@@ -0,0 +1,67 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: theodolite
+spec:
+  template:
+    spec:
+      containers:
+      - name: theodolite
+        image: theodolite:latest
+        imagePullPolicy: Never
+        env:
+        - name: UC
+          value: "1"
+        - name: LOADS
+          value: "13206, 19635"
+        - name: INSTANCES
+          value: "1, 2"
+        - name: DURATION
+          value: "3"
+        - name: PARTITIONS
+          value: "30"
+        # - name: COMMIT_MS
+        #   value: ""
+        # - name: SEARCH_STRATEGY
+        #   value: ""
+        # - name: CPU_LIMIT
+        #   value: ""
+        # - name: MEMORY_LIMIT
+        #   value: ""
+        - name: PROMETHEUS_BASE_URL
+          value: "http://prometheus-operated:9090"
+        - name: PYTHONUNBUFFERED
+          value: "1"
+      restartPolicy: Never
+  backoffLimit: 4
+
+# ---
+# apiVersion: v1
+# kind: ServiceAccount
+# metadata:
+#   name: theodolite
+# ---
+# apiVersion: rbac.authorization.k8s.io/v1
+# kind: Role
+# metadata:
+#   name: modify-pods
+# rules:
+#   - apiGroups: [""]
+#     resources:
+#       - pods
+#     verbs:
+#       - get
+#       - list
+#       - delete
+# ---
+# apiVersion: rbac.authorization.k8s.io/v1
+# kind: RoleBinding
+# metadata:
+#   name: modify-pods-to-sa
+# subjects:
+#   - kind: ServiceAccount
+#     name: theodolite
+# roleRef:
+#   kind: Role
+#   name: modify-pods
+#   apiGroup: rbac.authorization.k8s.io
-- 
GitLab