Files
infrastructure/servers/legion/k8s/mudcraft/statefulset.yaml
2026-04-21 16:21:10 -05:00

158 lines
4.9 KiB
YAML

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mudcraft
namespace: mudcraft
labels:
app: mudcraft
spec:
replicas: 0
serviceName: mudcraft
selector:
matchLabels:
app: mudcraft
template:
metadata:
labels:
app: mudcraft
annotations:
kubectl.kubernetes.io/restartedAt: "2026-03-30T03:30:00Z"
spec:
terminationGracePeriodSeconds: 120
securityContext:
fsGroup: 1000
initContainers:
# Copies plugin JARs from the mudcraft/plugins image into the plugins PVC.
# To add/update plugins: update the Dockerfile in mudcraft/mudcraft repo,
# push to main — CI rebuilds the image and the next pod restart picks it up.
- name: install-plugins
image: registry.neuralplatform.ai/mudcraft/plugins:ce051316ceda4e06ebea931a7c4b16fd9f0f6887
imagePullPolicy: Always
securityContext:
runAsUser: 1000
runAsGroup: 1000
env:
- name: LP_PASSWORD
valueFrom:
secretKeyRef:
name: mudcraft-secrets
key: db-password
command:
- sh
- -c
- |
rm -rf /target/*.jar
cp -r /plugins/* /target/
mkdir -p /target/LuckPerms
sed "s|\${LP_PASSWORD}|${LP_PASSWORD}|g" /luckperms-config/config.yml > /target/LuckPerms/config.yml
mkdir -p /target/PurpurExtras
cp /purpurextras-config/config.yml /target/PurpurExtras/config.yml
mkdir -p /target/voicechat
cp /voicechat-config/voicechat-server.properties /target/voicechat/voicechat-server.properties
echo 'Plugins installed'
volumeMounts:
- name: plugins
mountPath: /target
- name: luckperms-config
mountPath: /luckperms-config
- name: purpurextras-config
mountPath: /purpurextras-config
- name: voicechat-config
mountPath: /voicechat-config
containers:
- name: mudcraft
image: itzg/minecraft-server:java21
imagePullPolicy: Always
ports:
- name: minecraft
containerPort: 25565
protocol: TCP
- name: rcon
containerPort: 25575
protocol: TCP
- name: voicechat
containerPort: 24454
protocol: UDP
envFrom:
- configMapRef:
name: mudcraft-config
env:
- name: RCON_PASSWORD
valueFrom:
secretKeyRef:
name: mudcraft-secrets
key: rcon-password
- name: DB_URL
value: "jdbc:postgresql://postgres-postgresql.platform.svc.cluster.local:5432/mudcraft"
- name: DB_USER
value: "mudcraft"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mudcraft-secrets
key: db-password
- name: LP_PASSWORD
valueFrom:
secretKeyRef:
name: mudcraft-secrets
key: db-password
volumeMounts:
- name: worlds
mountPath: /data/worlds
- name: plugins
mountPath: /data/plugins
- name: logs
mountPath: /data/logs
- name: luckperms-bootstrap
mountPath: /bootstrap
resources:
requests:
memory: 5Gi
cpu: 500m
limits:
memory: 6Gi
cpu: 4000m
lifecycle:
postStart:
exec:
command: ["/bin/sh", "/bootstrap/bootstrap.sh"]
preStop:
exec:
command: ["/bin/sh", "-c", "rcon-cli stop && sleep 15"]
readinessProbe:
tcpSocket:
port: 25565
initialDelaySeconds: 60
periodSeconds: 15
failureThreshold: 10
livenessProbe:
tcpSocket:
port: 25565
initialDelaySeconds: 120
periodSeconds: 30
failureThreshold: 5
volumes:
- name: worlds
persistentVolumeClaim:
claimName: mudcraft-worlds
- name: plugins
persistentVolumeClaim:
claimName: mudcraft-plugins
- name: logs
persistentVolumeClaim:
claimName: mudcraft-logs
- name: purpurextras-config
configMap:
name: mudcraft-purpurextras
- name: luckperms-config
configMap:
name: mudcraft-luckperms
- name: voicechat-config
configMap:
name: mudcraft-voicechat
- name: luckperms-bootstrap
configMap:
name: mudcraft-luckperms-bootstrap
defaultMode: 0755