Private
Public Access
1
0

fix
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m43s

This commit is contained in:
Sebastian Unterschütz
2025-12-05 21:56:44 +01:00
parent ae3eb34c0e
commit 141f74c6ad
9 changed files with 944 additions and 391 deletions

View File

@@ -1,14 +1,3 @@
apiVersion: v1
kind: Service
metadata:
name: escape-game
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: escape-game
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -16,7 +5,7 @@ metadata:
labels:
app: escape-game
spec:
replicas: 1
replicas: 1 # Kannst du bei RWX auch hochskalieren!
selector:
matchLabels:
app: escape-game
@@ -25,9 +14,30 @@ spec:
labels:
app: escape-game
spec:
initContainers:
- name: init-assets
image: ${IMAGE_NAME}
command: ["/bin/sh", "-c"]
args:
- |
echo "Prüfe Assets..."
# Wenn das Volume leer ist (nur lost+found), kopiere Originale
if [ -z "$(ls -A /mnt/assets)" ]; then
echo "Volume leer. Kopiere Basis-Assets..."
cp -r /app/static/assets/* /mnt/assets/
else
echo "Assets existieren bereits. Überspringe Copy."
# Optional: 'cp -n' nutzen um neue Default-Assets zu ergänzen ohne Uploads zu überschreiben
cp -rn /app/static/assets/* /mnt/assets/ || true
fi
volumeMounts:
- name: assets-vol
mountPath: /mnt/assets
# --- MAIN CONTAINER ---
containers:
- name: game
image: ${IMAGE_NAME} # Wird von CI ersetzt
image: ${IMAGE_NAME}
ports:
- containerPort: 8080
env:
@@ -37,24 +47,34 @@ spec:
value: "${ADMIN_USER}"
- name: ADMIN_PASS
value: "${ADMIN_PASS}"
# HIER DAS VOLUME EINHÄNGEN
volumeMounts:
- name: assets-vol
mountPath: /app/static/assets
resources:
requests:
memory: "64Mi"
cpu: "50m"
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
memory: "512Mi"
cpu: "1000m"
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
initialDelaySeconds: 10
periodSeconds: 10
volumes:
- name: assets-vol
persistentVolumeClaim:
claimName: game-assets-pvc

12
k8s/pvc.yaml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: game-assets-pvc
namespace: ${TARGET_NS}
spec:
accessModes:
- ReadWriteMany
storageClassName: longhorn
resources:
requests:
storage: 2Gi