ntwl/surf/megastructure-surf.yaml
2026-02-09 22:34:36 +11:00

170 lines
3.8 KiB
YAML
Executable File

---
apiVersion: v1
kind: Namespace
metadata:
name: surf
# -----------------------------------------------------------------------
# VOLUMES
# -----------------------------------------------------------------------
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: cssds-data
namespace: surf
spec:
storageClassName: fast
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
---
# -----------------------------------------------------------------------
# DEPLOYMENT
# -----------------------------------------------------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
name: megastructure-surf
namespace: surf
spec:
replicas: 1
selector:
matchLabels:
app: megastructure-surf
template:
metadata:
labels:
app: megastructure-surf
spec:
initContainers:
- name: fix-permissions
image: busybox
command: ['sh', '-c', 'chown -R 1000:1000 /home/steam/cssds']
volumeMounts:
- name: cssds
mountPath: /home/steam/cssds
containers:
- name: megastructure-surf
image: registry.ntwl.xyz/megastructure-surf
imagePullPolicy: Always
command: ["sleep", "100000000"]
ports:
- containerPort: 27015
- containerPort: 27005
envFrom:
- secretRef:
name: surf
volumeMounts:
- name: cssds
mountPath: /home/steam/cssds
volumes:
- name: cssds
persistentVolumeClaim:
claimName: cssds-data
---
# -----------------------------------------------------------------------
# SERVICES
# -----------------------------------------------------------------------
apiVersion: v1
kind: Service
metadata:
name: megastructure-surf
namespace: surf
spec:
type: NodePort
selector:
app: megastructure-surf
ports:
- name: game-port
protocol: UDP
port: 27015
targetPort: 27015
nodePort: 32015
- name: client-port
protocol: UDP
port: 27005
targetPort: 27005
nodePort: 32005
---
# -----------------------------------------------------------------------
# MAP DOWNLOADER JOB
# -----------------------------------------------------------------------
apiVersion: batch/v1
kind: Job
metadata:
name: mapsdl
namespace: surf
spec:
# Don't automatically restart on failure
backoffLimit: 2
# Clean up completed jobs after 1 hour
ttlSecondsAfterFinished: 3600
template:
spec:
restartPolicy: Never
containers:
- name: mapsdl
image: registry.ntwl.xyz/megastructure-surf-mapsdl:latest
imagePullPolicy: Always
# Override default dry-run command to actually download
# command:
# - "deno"
# - "run"
# - "--allow-net"
# - "--allow-read"
# - "--allow-write"
# - "--allow-env"
# - "--allow-sys"
# - "mapsdl.ts"
env:
- name: MAPS_DIR
value: "/maps"
- name: TEMP_DIR
value: "/tmp/mapsdl"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/app/credentials/service-account.json"
volumeMounts:
# Mount the same PVC as cssds for maps
- name: cssds
mountPath: /maps
subPath: cstrike/maps
# Mount credentials from secret
- name: credentials
mountPath: /app/credentials
readOnly: true
volumes:
# Use the same PVC as the cssds deployment
- name: cssds
persistentVolumeClaim:
claimName: cssds-data
# Mount the Google service account credentials
- name: credentials
secret:
secretName: mapsdl-credentials
---