From 03da1899fde53ba7f3f2565b15f6fd161e75eb3a Mon Sep 17 00:00:00 2001
From: royalcat <k.adamovich20@gmail.com>
Date: Sun, 9 Mar 2025 00:08:18 +0400
Subject: [PATCH] minecraft-tfg

---
 minecraft/curseforge-downloads-pvc.yaml | 11 ++++
 minecraft/tfg-deployment.yaml           | 71 +++++++++++++++++++++++++
 minecraft/tfg-pvc.yaml                  | 13 +++++
 minecraft/tfg-service.yaml              | 16 ++++++
 4 files changed, 111 insertions(+)
 create mode 100644 minecraft/curseforge-downloads-pvc.yaml
 create mode 100644 minecraft/tfg-deployment.yaml
 create mode 100644 minecraft/tfg-pvc.yaml
 create mode 100644 minecraft/tfg-service.yaml

diff --git a/minecraft/curseforge-downloads-pvc.yaml b/minecraft/curseforge-downloads-pvc.yaml
new file mode 100644
index 0000000..dd69400
--- /dev/null
+++ b/minecraft/curseforge-downloads-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: curseforge-downloads
+  namespace: minecraft
+spec:
+  accessModes:
+    - ReadWriteMany
+  resources:
+    requests:
+      storage: 10Gi
diff --git a/minecraft/tfg-deployment.yaml b/minecraft/tfg-deployment.yaml
new file mode 100644
index 0000000..944c966
--- /dev/null
+++ b/minecraft/tfg-deployment.yaml
@@ -0,0 +1,71 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: tfg
+  namespace: minecraft
+  labels:
+    app.kubernetes.io/name: tfg
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: tfg
+  strategy:
+    type: Recreate
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/name: tfg
+    spec:
+      containers:
+        - name: tfg
+          image: itzg/minecraft-server:java21-graalvm
+          env:
+            - name: ALLOW_FLIGHT
+              value: "true"
+            - name: CF_API_KEY
+              value: $2a$10$GE.ruAAiogu1Zq2/oyPhzuGgFkXxID2ofiIXtnehJlS98/sK6J.Ya
+            - name: CF_FILE_ID
+              value: "6123835"
+            - name: CF_OVERRIDES_EXCLUSIONS
+              value: |
+                shaderpacks/**
+            - name: CF_PARALLEL_DOWNLOADS
+              value: "1"
+            - name: CF_SLUG
+              value: terrafirmagreg-modern
+            - name: EULA
+              value: "TRUE"
+            - name: MAX_TICK_TIME
+              value: "-1"
+            - name: MEMORY
+              value: 12G
+            - name: MOD_PLATFORM
+              value: AUTO_CURSEFORGE
+            - name: ONLINE_MODE
+              value: "false"
+            - name: OVERRIDE_SERVER_PROPERTIES
+              value: "true"
+            - name: SPAWN_PROTECTION
+              value: "0"
+            - name: OPS
+              value: |
+                RoyalCat33
+                RoyalCat20
+                Zoryka
+          ports:
+            - containerPort: 25565
+              protocol: TCP
+          volumeMounts:
+            - mountPath: /data
+              name: tfg-data
+            - mountPath: /downloads
+              name: curseforge-downloads
+      restartPolicy: Always
+      volumes:
+        - name: tfg-data
+          persistentVolumeClaim:
+            claimName: tfg-data
+        - name: curseforge-downloads
+          persistentVolumeClaim:
+            claimName: curseforge-downloads
diff --git a/minecraft/tfg-pvc.yaml b/minecraft/tfg-pvc.yaml
new file mode 100644
index 0000000..95d11da
--- /dev/null
+++ b/minecraft/tfg-pvc.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: tfg-data
+  namespace: minecraft
+  labels:
+    app.kubernetes.io/name: tfg
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 15Gi
diff --git a/minecraft/tfg-service.yaml b/minecraft/tfg-service.yaml
new file mode 100644
index 0000000..1a771ee
--- /dev/null
+++ b/minecraft/tfg-service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: tfg
+  namespace: minecraft
+  labels:
+    app.kubernetes.io/name: tfg
+spec:
+  type: NodePort
+  selector:
+    app.kubernetes.io/name: tfg
+  ports:
+    - name: "25565"
+      port: 25565
+      targetPort: 25565
+      nodePort: 32565