From 59f56c64a392aa959b8674309148664180b3d94f Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 15 Oct 2024 00:07:17 -0700 Subject: [PATCH] add meshtastic --- k8s/generic-device-plugin/ds.yaml | 8 +++ k8s/meshtastic/kustomization.yaml | 10 ++++ k8s/meshtastic/matrix-meshtastic-bridge.yaml | 56 +++++++++++++++++++ .../matrix-meshtastic-bridge/config.json | 12 ++++ k8s/meshtastic/namespace.yaml | 4 ++ 5 files changed, 90 insertions(+) create mode 100644 k8s/meshtastic/kustomization.yaml create mode 100644 k8s/meshtastic/matrix-meshtastic-bridge.yaml create mode 100644 k8s/meshtastic/matrix-meshtastic-bridge/config.json create mode 100644 k8s/meshtastic/namespace.yaml diff --git a/k8s/generic-device-plugin/ds.yaml b/k8s/generic-device-plugin/ds.yaml index 4709c7f..b425306 100644 --- a/k8s/generic-device-plugin/ds.yaml +++ b/k8s/generic-device-plugin/ds.yaml @@ -40,6 +40,14 @@ spec: usb: - vendor: "0BDA" product: "2838" + - --device + - | + name: meshtastic + groups: + - count: 1 + usb: + - vendor: "1A86" + product: "55D4" name: generic-device-plugin resources: requests: diff --git a/k8s/meshtastic/kustomization.yaml b/k8s/meshtastic/kustomization.yaml new file mode 100644 index 0000000..92bb515 --- /dev/null +++ b/k8s/meshtastic/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: meshtastic +resources: + - namespace.yaml + - matrix-meshtastic-bridge.yaml +secretGenerator: + - name: matrix-meshtastic-bridge + files: + - matrix-meshtastic-bridge/config.json diff --git a/k8s/meshtastic/matrix-meshtastic-bridge.yaml b/k8s/meshtastic/matrix-meshtastic-bridge.yaml new file mode 100644 index 0000000..0fe390e --- /dev/null +++ b/k8s/meshtastic/matrix-meshtastic-bridge.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: matrix-meshtastic-bridge +spec: + selector: + matchLabels: + app: matrix-meshtastic-bridge + serviceName: matrix-meshtastic-bridge + replicas: 1 + template: + metadata: + labels: + app: matrix-meshtastic-bridge + spec: + tolerations: + - key: rtlsdr + value: "true" + effect: NoSchedule + containers: + - name: matrix-meshtastic-bridge + image: git.janky.solutions/finn/matrix-meshtastic-bridge:sha-008f7cd + securityContext: + privileged: true + env: + - name: RUST_LOG + value: debug + - name: CONFIG_PATH + value: /config/config.json + resources: + limits: + janky.solutions/meshtastic: "1" + volumeMounts: + - name: config + mountPath: /config + - name: ttyacm0 + mountPath: /dev/ttyACM0 + - name: data + mountPath: /data + volumes: + - name: config + secret: + secretName: matrix-meshtastic-bridge + - name: ttyacm0 + hostPath: + type: CharDevice + path: /dev/ttyACM0 + volumeClaimTemplates: + - metadata: + name: data + spec: + storageClassName: longhorn + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Gi diff --git a/k8s/meshtastic/matrix-meshtastic-bridge/config.json b/k8s/meshtastic/matrix-meshtastic-bridge/config.json new file mode 100644 index 0000000..ab6af29 --- /dev/null +++ b/k8s/meshtastic/matrix-meshtastic-bridge/config.json @@ -0,0 +1,12 @@ +{ + "matrix": { + "username": "@meshtastic-test:janky.bot", + "room": "!VRoqFXTXJCHdTDdilP:janky.solutions", + "user": "@finn:janky.solutions", + "state": "/data/matrix.db" + }, + "meshtastic": { + "device": "/dev/ttyACM0" + }, + "db": "sqlite:///data/bridge.db" +} diff --git a/k8s/meshtastic/namespace.yaml b/k8s/meshtastic/namespace.yaml new file mode 100644 index 0000000..0c29a84 --- /dev/null +++ b/k8s/meshtastic/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: meshtastic