Files
infrastructure/servers/legion/k8s/mudcraft/statefulset.yaml
T
Will Anderson 63d54d9ea0 fix(mudcraft): substitute LP_PASSWORD in LuckPerms config at init time
LuckPerms reads config.yml as a literal string — ${LP_PASSWORD} was
never being substituted, causing auth failures against PostgreSQL.
initContainer now has the secret injected as an env var and uses sed
to write the real password into the config before LuckPerms reads it.

Also adds faultexception to WHITELIST so they can connect.
2026-03-29 20:41:39 -05:00

142 lines
4.3 KiB
YAML

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mudcraft
namespace: mudcraft
labels:
app: mudcraft
spec:
replicas: 1
serviceName: mudcraft
selector:
matchLabels:
app: mudcraft
template:
metadata:
labels:
app: mudcraft
annotations:
kubectl.kubernetes.io/restartedAt: "2026-03-30T02:45: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:d2528281d4d304a8ae62e0f73ba6aed034113d34
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
echo 'Plugins installed'
volumeMounts:
- name: plugins
mountPath: /target
- name: luckperms-config
mountPath: /luckperms-config
- name: purpurextras-config
mountPath: /purpurextras-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
resources:
requests:
memory: 5Gi
cpu: 500m
limits:
memory: 6Gi
cpu: 4000m
lifecycle:
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