Private
Public Access
1
0
Files
it232Abschied/k8s/app.yaml
Sebastian Unterschütz 141f74c6ad
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m43s
fix
2025-12-05 21:56:44 +01:00

80 lines
2.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: escape-game
labels:
app: escape-game
spec:
replicas: 1 # Kannst du bei RWX auch hochskalieren!
selector:
matchLabels:
app: escape-game
template:
metadata:
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}
ports:
- containerPort: 8080
env:
- name: REDIS_ADDR
value: "redis:6379"
- name: ADMIN_USER
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: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "1000m"
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
volumes:
- name: assets-vol
persistentVolumeClaim:
claimName: game-assets-pvc