Skip to content

Commit 54b274b

Browse files
authored
feat: overriding BACKUP_NAME and set RESTIC_HOSTNAME (#274)
1 parent 1c29d4f commit 54b274b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

charts/minecraft/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v1
22
name: minecraft
3-
version: 4.26.4
3+
version: 5.0.0
44
appVersion: SeeValues
55
home: https://minecraft.net/
66
description: Minecraft server

charts/minecraft/templates/deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ spec:
352352
env:
353353
- name: SRC_DIR
354354
value: "/data"
355-
{{- template "minecraft.envMap" list "BACKUP_NAME" .Values.minecraftServer.worldSaveName }}
355+
{{- template "minecraft.envMap" list "BACKUP_NAME" (.Values.mcbackup.backupName | default .Values.minecraftServer.worldSaveName) }}
356356
{{- template "minecraft.envMap" list "INITIAL_DELAY" .Values.mcbackup.initialDelay }}
357357
{{- template "minecraft.envMap" list "BACKUP_INTERVAL" .Values.mcbackup.backupInterval }}
358358
{{- template "minecraft.envMap" list "PRUNE_BACKUPS_DAYS" .Values.mcbackup.pruneBackupsDays }}
@@ -388,6 +388,7 @@ spec:
388388
{{- template "minecraft.envMap" list "RESTIC_REPOSITORY" .Values.mcbackup.resticRepository }}
389389
{{- template "minecraft.envMap" list "RESTIC_ADDITIONAL_TAGS" .Values.mcbackup.resticAdditionalTags }}
390390
{{- template "minecraft.envMap" list "PRUNE_RESTIC_RETENTION" .Values.mcbackup.pruneResticRetention }}
391+
{{- template "minecraft.envMap" list "RESTIC_HOSTNAME" (required "mcbackup.resticHostname is required" .Values.mcbackup.resticHostname) }}
391392
{{- range $key, $value := .Values.mcbackup.resticEnvs }}
392393
{{- if kindIs "map" $value }}
393394
{{- if hasKey $value "valueFrom" }}

charts/minecraft/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@ mcbackup:
483483
# wait 2 minutes before starting
484484
initialDelay: 2m
485485

486+
# Sets `BACKUP_NAME`, defaults to `minecraftServer.worldSaveName`
487+
# WARN: When using restic and sharing the `mcbackup.resticRepository` across multiple minecraft server deployments: either `mcbackup.backupName` or `mcbackup.resticHostname` must be unique!
488+
backupName:
489+
486490
# ***set to 0 or smaller, script will run once and exit. DO NOT SET TO 0 or smaller, this will cause K8s to kill your pod!***
487491
# backupInterval="1.5d" -> backup every one and a half days (36 hours)
488492
# backupInterval="2h 30m" -> backup every two and a half hours
@@ -538,6 +542,10 @@ mcbackup:
538542
resticAdditionalTags: "mc_backups"
539543
# see https://restic.readthedocs.io/en/latest/060_forget.html
540544
pruneResticRetention: "--keep-daily 7 --keep-weekly 5 --keep-monthly 12 --keep-yearly 75"
545+
# Sets `RESTIC_HOSTNAME`
546+
# Required because the container hostname changes on every recreate of the pod which prevents restic from pruning snapshots from previous pods/hostnames
547+
# WARN: When using restic and sharing the `mcbackup.resticRepository` across multiple minecraft server deployments: either `mcbackup.backupName` or `mcbackup.resticHostname` must be unique!
548+
resticHostname:
541549

542550
# At least one of RESTIC_PASSWORD* env variables need to be defined, see https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html
543551
resticEnvs:

0 commit comments

Comments
 (0)