feat(minecraft-java) add mc-backup sidecar (#10474)

**Description**
Add mc-backup as a sidecar
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [X] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [X] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com>
Signed-off-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Co-authored-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
This commit is contained in:
Xstar97TheNoob 2023-12-20 07:02:35 -05:00 committed by GitHub
parent 717aa5f148
commit 47ea827db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 191 additions and 10 deletions

View File

@ -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

View File

@ -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}

View File

@ -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" . -}}

View File

@ -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