diff --git a/charts/stable/minecraft-java/Chart.yaml b/charts/stable/minecraft-java/Chart.yaml index f0c19449879..4268b570efa 100644 --- a/charts/stable/minecraft-java/Chart.yaml +++ b/charts/stable/minecraft-java/Chart.yaml @@ -1,7 +1,7 @@ kubeVersion: ">=1.24.0-0" apiVersion: v2 name: minecraft-java -version: 5.1.4 +version: 5.2.0 appVersion: 2023.11.1 description: Minecraft Java Dedicated Server home: https://truecharts.org/charts/stable/minecraft-java diff --git a/charts/stable/minecraft-java/questions.yaml b/charts/stable/minecraft-java/questions.yaml index 5f5a15e4552..f3b3eb0378f 100644 --- a/charts/stable/minecraft-java/questions.yaml +++ b/charts/stable/minecraft-java/questions.yaml @@ -53,7 +53,7 @@ questions: type: dict attrs: - variable: RCON_PASSWORD - label: RCON_PASSWORD + label: Rcon Password description: This will only have effect in the first installation or always if OVERRIDE_SERVER_PROPERTIES is enabled schema: type: string @@ -211,6 +211,12 @@ questions: type: string default: "" show_if: [[TYPE, "=", "FABRIC"]] + - variable: PACKWIZ_URL + label: Packwiz URL + schema: + type: string + default: "" + show_if: [[TYPE, "=", "FABRIC"]] - variable: SPIGOT_DOWNLOAD_URL label: Spigot Download URL schema: @@ -241,12 +247,6 @@ questions: type: string default: "" show_if: [[TYPE, "=", "PAPER"]] - - variable: PACKWIZ_URL - label: Packwiz URL - schema: - type: string - default: "" - show_if: [[TYPE, "=", "PAPER"]] - variable: AIRPLANE_BUILD label: Airplane Build schema: @@ -630,8 +630,102 @@ questions: schema: type: string default: "" + # Include{containerBasic} # Include{containerAdvanced} + + - variable: mcbackup + group: App Configuration + label: MC Backup Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: enabled + label: Enable MC Backup Container + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: initial_delay + label: Initial Delay + schema: + type: string + default: 2m + - variable: backup_interval + label: Backup Interval + schema: + type: string + default: 24hr + - variable: player_online_check_interval + label: Player Online Check Interval + schema: + type: string + default: 5m + - variable: prune_backups_days + label: Prune Backups Days + schema: + type: int + default: 7 + - variable: pause_if_no_players + label: Pause If No Players + schema: + type: boolean + default: false + - variable: link_latest + label: Link Latest + description: Creates a symbolic link to the latest backup. + schema: + type: boolean + default: false + - variable: tar_compress_method + label: Tar Compress Method + schema: + type: string + default: gzip + enum: + - value: gzip + description: Gzip + - value: bzip2 + description: Bzip2 + - value: zstd + description: Zstd + - variable: zstd_params + label: ZSTD Params + schema: + type: list + empty: false + default: + - --long=25 + - --single-thread + required: true + items: + - variable: param + label: Param + schema: + type: string + required: true + default: "" + - variable: excludes + label: Excludes + schema: + type: list + empty: false + default: + - "*.jar" + - "cache" + - "logs" + - "*.tmp" + required: true + items: + - variable: exclude + label: Exclude + schema: + type: string + required: true + default: "" + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} @@ -703,6 +797,14 @@ questions: additional_attrs: true type: dict attrs: +# Include{persistenceBasic} + - variable: backups + label: App Backups Storage + description: Stores the Application Backups. + schema: + additional_attrs: true + type: dict + attrs: # Include{persistenceBasic} # Include{persistenceList} diff --git a/charts/stable/minecraft-java/templates/common.yaml b/charts/stable/minecraft-java/templates/common.yaml index b51394e00a4..9e1f2f3bf4e 100644 --- a/charts/stable/minecraft-java/templates/common.yaml +++ b/charts/stable/minecraft-java/templates/common.yaml @@ -1 +1,10 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Disable [mcbackup] if requested */}} +{{- if not .Values.mcbackup.enabled -}} + {{- $_ := set .Values.workload.mcbackup "enabled" false -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/minecraft-java/values.yaml b/charts/stable/minecraft-java/values.yaml index 2fd770125d8..4f88f42954e 100644 --- a/charts/stable/minecraft-java/values.yaml +++ b/charts/stable/minecraft-java/values.yaml @@ -58,6 +58,10 @@ j8j9Image: repository: itzg/minecraft-server tag: 2023.11.1-java8-openj9@sha256:076c6a872b241df47580064171e67ff6d9b1826134169fe4201c5cedd3456f58 pullPolicy: Always +mcBackupImage: + repository: itzg/mc-backup + tag: latest@sha256:13d66ffdc2d120308b55a4a10a992fe75bbb6295f6fd88bd53658c02423e4e80 + pullPolicy: Always service: main: @@ -78,6 +82,27 @@ service: enabled: true port: 25575 +mcbackup: + enabled: true + initial_delay: 2m + backup_interval: 24hr + player_online_check_interval: 5m + prune_backups_days: 7 + pause_if_no_players: false + link_latest: false + # values gzip,bzip2,zstd + tar_compress_method: gzip + # White spaced separated list + zstd_params: + - --long=25 + - --single-thread + # comma separated list + excludes: + - "*.jar" + - "cache" + - "logs" + - "*.tmp" + workload: main: podSpec: @@ -187,10 +212,55 @@ workload: # CF_OVERRIDES_SKIP_EXISTING # CF_PARALLEL_DOWNLOADS # CF_SET_LEVEL_FROM + mcbackup: + enabled: true + type: Deployment + podSpec: + containers: + mcbackup: + primary: true + enabled: true + imageSelector: mcBackupImage + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + env: + BACKUP_METHOD: "tar" + DEST_DIR: "{{.Values.persistence.backups.mountPath }}" + SRC_DIR: "{{.Values.persistence.data.mountPath }}" + SERVER_PORT: "{{ .Values.service.main.ports.main.port }}" + RCON_HOST: '{{ include "tc.v1.common.lib.chart.names.fullname" $ }}' + RCON_PORT: "{{ .Values.service.rcon.ports.rcon.port }}" + RCON_PASSWORD: "{{ .Values.workload.main.podSpec.containers.main.env.RCON_PASSWORD }}" + INITIAL_DELAY: "{{ .Values.mcbackup.initial_delay }}" + BACKUP_INTERVAL: "{{ .Values.mcbackup.backup_interval }}" + PRUNE_BACKUPS_DAYS: "{{ .Values.mcbackup.prune_backups_days }}" + PAUSE_IF_NO_PLAYERS: "{{ .Values.mcbackup.pause_if_no_players }}" + PLAYERS_ONLINE_CHECK_INTERVAL: "{{ .Values.mcbackup.player_online_check_interval }}" + LINK_LATEST: "{{ .Values.mcbackup.link_latest }}" + TAR_COMPRESS_METHOD: "{{ .Values.mcbackup.tar_compress_method }}" + ZSTD_PARAMETERS: '{{ join " " .Values.mcbackup.zstd_params }}' + EXCLUDES: '{{ join "," .Values.mcbackup.excludes }}' + persistence: data: enabled: true - mountPath: "/data" + targetSelector: + main: + main: + mountPath: /data + mcbackup: + mcbackup: + mountPath: /data + readOnly: true + backups: + enabled: true + mountPath: /backups + portal: open: enabled: false