Files
helm-charts/minecraft-server/templates/init-script-configmap.yaml
T
jklein a68192e5fb Import minecraft-server chart for Fleet migration stage 1 (java8 line)
Imports the chart from cluster-config functionally unchanged, wires it into
the publish/validate/install-test pipelines and publishes it as the first of
three Java lines (0.4.0+upjava8).

The only deviation from the source chart is the chart-global scaleDown flag
plus a server.replicas value, following the satisfactory pattern: two of the
three servers stand at 0 replicas in the cluster, which the chart could not
express, and Fleet would otherwise start them on reconcile. The default
(scaleDown: false) still renders replicas: 1, so the rendering of the running
server is unchanged - verified byte-identical against the three real values
files for all three Java lines.

Known deficiencies (hardening, probes, naming scheme, hardcoded values,
missing icon, the misleading mc-router auto-discovery annotations) are left
untouched on purpose and are scheduled for stage 2.
2026-08-23 15:57:17 +02:00

43 lines
1.3 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-init-config
data:
init.sh: |
echo "downloading serverpack"
wget -O /modpacks/serverpack.zip {{ .Values.curseforgeServerpack.downloadUrl }}
SERVERPACK_DIR="{{ .Values.curseforgeServerpack.workingDirectory }}"
BACKUP_DIR="/data/serverpack-backup"
if [ -d "$SERVERPACK_DIR" ]; then
echo "found installed server. Migrating..."
if [ -d "$BACKUP_DIR" ]; then
echo "clearing old Backup"
rm -rf $BACKUP_DIR
fi
echo "backing up old server-files"
cp -r $SERVERPACK_DIR $BACKUP_DIR
rm -rf $SERVERPACK_DIR
mkdir $SERVERPACK_DIR
echo "extracting new server-files"
tar -xvf /modpacks/serverpack.zip -C $SERVERPACK_DIR
echo "copying old configuration-data"
cp -r $BACKUP_DIR/world $SERVERPACK_DIR/world
cp $BACKUP_DIR/banned-ips.json $SERVERPACK_DIR/banned-ips.json
cp $BACKUP_DIR/banned-players.json $SERVERPACK_DIR/banned-players.json
cp $BACKUP_DIR/ops.json $SERVERPACK_DIR/ops.json
cp $BACKUP_DIR/whitelist.json $SERVERPACK_DIR/whitelist.json
echo "change owner of files"
chown -R 1000:1000 $SERVERPACK_DIR
echo "successfully migrated server"
# echo "deleting serverpack.zip"
# rm /modpacks/serverpack.zip
fi