From 33f6e95e71e258c65841dc5060d442e489b30ed6 Mon Sep 17 00:00:00 2001 From: Shahab Dogar Date: Sat, 13 Sep 2025 12:35:28 +0500 Subject: [PATCH] feat: add minecraft server running monifactory --- minecraft/namespace.yaml | 5 +++ minecraft/pvc.yaml | 25 +++++++++++++ minecraft/secrets.yaml | 10 +++++ minecraft/service.yaml | 15 ++++++++ minecraft/statefulset.yaml | 77 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+) create mode 100644 minecraft/namespace.yaml create mode 100644 minecraft/pvc.yaml create mode 100644 minecraft/secrets.yaml create mode 100644 minecraft/service.yaml create mode 100644 minecraft/statefulset.yaml diff --git a/minecraft/namespace.yaml b/minecraft/namespace.yaml new file mode 100644 index 0000000..bf3349c --- /dev/null +++ b/minecraft/namespace.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: minecraft \ No newline at end of file diff --git a/minecraft/pvc.yaml b/minecraft/pvc.yaml new file mode 100644 index 0000000..ee00438 --- /dev/null +++ b/minecraft/pvc.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: monifactory-data + namespace: minecraft +spec: + storageClassName: longhorn + accessModes: + - ReadWriteMany + resources: + requests: + storage: 250Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: modpacks + namespace: minecraft +spec: + storageClassName: longhorn + accessModes: + - ReadWriteMany + resources: + requests: + storage: 25Gi diff --git a/minecraft/secrets.yaml b/minecraft/secrets.yaml new file mode 100644 index 0000000..b1972c4 --- /dev/null +++ b/minecraft/secrets.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: onepassword.com/v1 +kind: OnePasswordItem +metadata: + name: curseforge + namespace: minecraft + annotations: + operator.1password.io/auto-restart: "true" +spec: + itemPath: "vaults/Lab/items/curseforge" diff --git a/minecraft/service.yaml b/minecraft/service.yaml new file mode 100644 index 0000000..c3c0541 --- /dev/null +++ b/minecraft/service.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: monifactory-server + namespace: minecraft + labels: + app: monifactory-server +spec: + type: ClusterIP + ports: + - name: monifactory + port: 25565 + selector: + app: monifactory-server diff --git a/minecraft/statefulset.yaml b/minecraft/statefulset.yaml new file mode 100644 index 0000000..1ecaaa8 --- /dev/null +++ b/minecraft/statefulset.yaml @@ -0,0 +1,77 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: monifactory-server + namespace: minecraft +spec: + selector: + matchLabels: + app: monifactory-server + template: + metadata: + labels: + app: monifactory-server + spec: + containers: + - name: monifactory-server + image: itzg/minecraft-server:java17 + env: + - name: EULA + value: "TRUE" + - name: MODE + value: "survival" + - name: DIFFICULTY + value: "peaceful" + - name: MODPACK_PLATFORM + value: "AUTO_CURSEFORGE" + - name: CF_API_KEY + value: "$2a$10$12Z0ZWRDkHKShnN2gdZdY./Cj8BjpzIdcwuFXx9HrPsPUH90vwHcK" + - name: CF_PAGE_URL + value: "https://www.curseforge.com/minecraft/modpacks/monifactory/" + - name: VERSION + value: "1.20.1" + - name: INIT_MEMORY + value: 4G + - name: MAX_MEMORY + value: 8G + - name: ALLOW_FLIGHT + value: "TRUE" + - name: ENABLE_ROLLING_LOGS + value: "TRUE" + - name: USE_MEOWICE_FLAGS + value: "TRUE" + ports: + - name: minecraft + containerPort: 25565 + resources: + requests: + cpu: 4 + memory: "4Gi" + limits: + cpu: 8 + memory: "8Gi" + readinessProbe: + exec: + command: + - mc-health + initialDelaySeconds: 30 + periodSeconds: 30 + livenessProbe: + exec: + command: + - mc-health + initialDelaySeconds: 30 + periodSeconds: 30 + volumeMounts: + - name: monifactory-data + mountPath: /data + - name: modpacks + mountPath: /modpacks + volumes: + - name: monifactory-data + persistentVolumeClaim: + claimName: monifactory-data + - name: modpacks + persistentVolumeClaim: + claimName: modpacks