From f32eb2aacf8e23899d43a5241d9162fa145e9783 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Mon, 15 Apr 2024 11:42:36 +0100 Subject: Move snekbox to new namespace --- .../namespaces/default/snekbox-forms/README.md | 5 -- .../default/snekbox-forms/deployment.yaml | 69 --------------------- .../namespaces/default/snekbox-forms/service.yaml | 11 ---- kubernetes/namespaces/default/snekbox/README.md | 5 -- kubernetes/namespaces/default/snekbox/service.yaml | 11 ---- .../namespaces/snekbox/snekbox-forms/README.md | 5 ++ .../snekbox/snekbox-forms/deployment.yaml | 70 ++++++++++++++++++++++ .../namespaces/snekbox/snekbox-forms/service.yaml | 12 ++++ kubernetes/namespaces/snekbox/snekbox/README.md | 5 ++ kubernetes/namespaces/snekbox/snekbox/service.yaml | 12 ++++ 10 files changed, 104 insertions(+), 101 deletions(-) delete mode 100644 kubernetes/namespaces/default/snekbox-forms/README.md delete mode 100644 kubernetes/namespaces/default/snekbox-forms/deployment.yaml delete mode 100644 kubernetes/namespaces/default/snekbox-forms/service.yaml delete mode 100644 kubernetes/namespaces/default/snekbox/README.md delete mode 100644 kubernetes/namespaces/default/snekbox/service.yaml create mode 100644 kubernetes/namespaces/snekbox/snekbox-forms/README.md create mode 100644 kubernetes/namespaces/snekbox/snekbox-forms/deployment.yaml create mode 100644 kubernetes/namespaces/snekbox/snekbox-forms/service.yaml create mode 100644 kubernetes/namespaces/snekbox/snekbox/README.md create mode 100644 kubernetes/namespaces/snekbox/snekbox/service.yaml (limited to 'kubernetes') diff --git a/kubernetes/namespaces/default/snekbox-forms/README.md b/kubernetes/namespaces/default/snekbox-forms/README.md deleted file mode 100644 index 4514032..0000000 --- a/kubernetes/namespaces/default/snekbox-forms/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Snekbox-forms - -This folder contains manifests for a Snekbox service specific to the forms project. This instance has no 3rd party libs installed, unlike regular snekbox, so submissions via forms can only use the stdlib. - -The deployment manifest for this service is based on in manifest found inside the snekbox repository at [python-discord/snekbox](https://github.com/python-discord/snekbox), modified only by removing the volume mount, and 3rd party dep installation script. diff --git a/kubernetes/namespaces/default/snekbox-forms/deployment.yaml b/kubernetes/namespaces/default/snekbox-forms/deployment.yaml deleted file mode 100644 index 2464249..0000000 --- a/kubernetes/namespaces/default/snekbox-forms/deployment.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: snekbox-forms -spec: - replicas: 1 - selector: - matchLabels: - app: snekbox-forms - template: - metadata: - labels: - app: snekbox-forms - spec: - initContainers: - - name: init-service - image: busybox:latest - command: ["/bin/sh", "-c"] - args: - - > - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/random.png -O /tmp/cj-inputs/random.png; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled1_order.txt -O /tmp/cj-inputs/shuffled1_order.txt; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled1.png -O /tmp/cj-inputs/shuffled1.png; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled4_order.txt -O /tmp/cj-inputs/shuffled4_order.txt; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled4.png -O /tmp/cj-inputs/shuffled4.png; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled8_order.txt -O /tmp/cj-inputs/shuffled8_order.txt; - wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled8.png -O /tmp/cj-inputs/shuffled8.png; - wget https://raw.githubusercontent.com/python-discord/snekbox/main/config/snekbox.cfg -O /tmp/config/snekbox.cfg; - echo -e 'mount {\n src:"/snekbox/cj-inputs"\n dst:"/cj-inputs"\n is_bind: true\n rw: false}' >> /tmp/config/snekbox.cfg; - volumeMounts: - - name: snekbox-cj-inputs - mountPath: /tmp/cj-inputs/ - - name: snekbox-forms-config - mountPath: /tmp/config/ - containers: - - name: snekbox-forms - image: ghcr.io/python-discord/snekbox:latest - imagePullPolicy: Always - ports: - - containerPort: 8060 - securityContext: - privileged: true - volumeMounts: - - name: snekbox-forms-user-base-volume - mountPath: /snekbox/user_base - - name: snekbox-cj-inputs - mountPath: /snekbox/cj-inputs - - name: snekbox-forms-config - mountPath: /snekbox/config/snekbox.cfg - subPath: snekbox.cfg - lifecycle: - postStart: - exec: - command: - - "/bin/sh" - - "-c" - - >- - PYTHONUSERBASE=/snekbox/user_base - pip install --user --upgrade - pip - pillow==10.0.0 - opencv-python-headless==4.8.0.74 - volumes: - - name: snekbox-forms-user-base-volume - emptyDir: {} - - name: snekbox-cj-inputs - emptyDir: {} - - name: snekbox-forms-config - emptyDir: {} diff --git a/kubernetes/namespaces/default/snekbox-forms/service.yaml b/kubernetes/namespaces/default/snekbox-forms/service.yaml deleted file mode 100644 index 99937eb..0000000 --- a/kubernetes/namespaces/default/snekbox-forms/service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: snekbox-forms -spec: - selector: - app: snekbox-forms - ports: - - protocol: TCP - port: 80 - targetPort: 8060 diff --git a/kubernetes/namespaces/default/snekbox/README.md b/kubernetes/namespaces/default/snekbox/README.md deleted file mode 100644 index bd7446b..0000000 --- a/kubernetes/namespaces/default/snekbox/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Snekbox - -This folder contains manifests for Snekbox service. - -The actual snekbox deployment manifest can be found inside the snekbox repository at [python-discord/snekbox](https://github.com/python-discord/snekbox). diff --git a/kubernetes/namespaces/default/snekbox/service.yaml b/kubernetes/namespaces/default/snekbox/service.yaml deleted file mode 100644 index 9ae20b0..0000000 --- a/kubernetes/namespaces/default/snekbox/service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: snekbox -spec: - selector: - app: snekbox - ports: - - protocol: TCP - port: 80 - targetPort: 8060 diff --git a/kubernetes/namespaces/snekbox/snekbox-forms/README.md b/kubernetes/namespaces/snekbox/snekbox-forms/README.md new file mode 100644 index 0000000..4514032 --- /dev/null +++ b/kubernetes/namespaces/snekbox/snekbox-forms/README.md @@ -0,0 +1,5 @@ +# Snekbox-forms + +This folder contains manifests for a Snekbox service specific to the forms project. This instance has no 3rd party libs installed, unlike regular snekbox, so submissions via forms can only use the stdlib. + +The deployment manifest for this service is based on in manifest found inside the snekbox repository at [python-discord/snekbox](https://github.com/python-discord/snekbox), modified only by removing the volume mount, and 3rd party dep installation script. diff --git a/kubernetes/namespaces/snekbox/snekbox-forms/deployment.yaml b/kubernetes/namespaces/snekbox/snekbox-forms/deployment.yaml new file mode 100644 index 0000000..bde867e --- /dev/null +++ b/kubernetes/namespaces/snekbox/snekbox-forms/deployment.yaml @@ -0,0 +1,70 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: snekbox-forms + namespace: snekbox +spec: + replicas: 1 + selector: + matchLabels: + app: snekbox-forms + template: + metadata: + labels: + app: snekbox-forms + spec: + initContainers: + - name: init-service + image: busybox:latest + command: ["/bin/sh", "-c"] + args: + - > + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/random.png -O /tmp/cj-inputs/random.png; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled1_order.txt -O /tmp/cj-inputs/shuffled1_order.txt; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled1.png -O /tmp/cj-inputs/shuffled1.png; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled4_order.txt -O /tmp/cj-inputs/shuffled4_order.txt; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled4.png -O /tmp/cj-inputs/shuffled4.png; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled8_order.txt -O /tmp/cj-inputs/shuffled8_order.txt; + wget https://files.pydis.wtf/33649562-5739-4f23-9219-28fc236b86bc/shuffled8.png -O /tmp/cj-inputs/shuffled8.png; + wget https://raw.githubusercontent.com/python-discord/snekbox/main/config/snekbox.cfg -O /tmp/config/snekbox.cfg; + echo -e 'mount {\n src:"/snekbox/cj-inputs"\n dst:"/cj-inputs"\n is_bind: true\n rw: false}' >> /tmp/config/snekbox.cfg; + volumeMounts: + - name: snekbox-cj-inputs + mountPath: /tmp/cj-inputs/ + - name: snekbox-forms-config + mountPath: /tmp/config/ + containers: + - name: snekbox-forms + image: ghcr.io/python-discord/snekbox:latest + imagePullPolicy: Always + ports: + - containerPort: 8060 + securityContext: + privileged: true + volumeMounts: + - name: snekbox-forms-user-base-volume + mountPath: /snekbox/user_base + - name: snekbox-cj-inputs + mountPath: /snekbox/cj-inputs + - name: snekbox-forms-config + mountPath: /snekbox/config/snekbox.cfg + subPath: snekbox.cfg + lifecycle: + postStart: + exec: + command: + - "/bin/sh" + - "-c" + - >- + PYTHONUSERBASE=/snekbox/user_base + pip install --user --upgrade + pip + pillow==10.0.0 + opencv-python-headless==4.8.0.74 + volumes: + - name: snekbox-forms-user-base-volume + emptyDir: {} + - name: snekbox-cj-inputs + emptyDir: {} + - name: snekbox-forms-config + emptyDir: {} diff --git a/kubernetes/namespaces/snekbox/snekbox-forms/service.yaml b/kubernetes/namespaces/snekbox/snekbox-forms/service.yaml new file mode 100644 index 0000000..7473ac0 --- /dev/null +++ b/kubernetes/namespaces/snekbox/snekbox-forms/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: snekbox-forms + namespace: snekbox +spec: + selector: + app: snekbox-forms + ports: + - protocol: TCP + port: 80 + targetPort: 8060 diff --git a/kubernetes/namespaces/snekbox/snekbox/README.md b/kubernetes/namespaces/snekbox/snekbox/README.md new file mode 100644 index 0000000..bd7446b --- /dev/null +++ b/kubernetes/namespaces/snekbox/snekbox/README.md @@ -0,0 +1,5 @@ +# Snekbox + +This folder contains manifests for Snekbox service. + +The actual snekbox deployment manifest can be found inside the snekbox repository at [python-discord/snekbox](https://github.com/python-discord/snekbox). diff --git a/kubernetes/namespaces/snekbox/snekbox/service.yaml b/kubernetes/namespaces/snekbox/snekbox/service.yaml new file mode 100644 index 0000000..ca4d67a --- /dev/null +++ b/kubernetes/namespaces/snekbox/snekbox/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: snekbox + namespace: snekbox +spec: + selector: + app: snekbox + ports: + - protocol: TCP + port: 80 + targetPort: 8060 -- cgit v1.2.3