From 8a595bfdbccb0249c9ccc9ce70cbb34042361011 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 7 Apr 2025 15:37:04 +0200 Subject: [PATCH] Migrate minecraft --- common/templates.yaml | 6 +- helmfiles/applications.yaml | 13 ++++ .../minecraft/secrets.yaml} | 0 .../minecraft/values.yaml} | 73 +++++-------------- values/common/games/minecraft/values.gotmpl | 33 +++++++++ 5 files changed, 69 insertions(+), 56 deletions(-) rename values/badhouseplants/{secrets.minecraft.yaml => games/minecraft/secrets.yaml} (100%) rename values/badhouseplants/{values.minecraft.yaml => games/minecraft/values.yaml} (67%) create mode 100644 values/common/games/minecraft/values.gotmpl diff --git a/common/templates.yaml b/common/templates.yaml index d6c7bfa..89ed10a 100644 --- a/common/templates.yaml +++ b/common/templates.yaml @@ -1,5 +1,5 @@ -#helmDefaults: -# kubeContext: "{{ `{{ .StateValues.kubeContext }}` }}" +helmDefaults: + kubeContext: {{ .StateValues.kubeContext }} templates: # --------------------------- @@ -71,7 +71,7 @@ templates: version: 2.0.0 alias: traefik values: - - '{{ requiredEnv "PWD" }}/values/common/values.tcp-route.yaml' + - '../values/common/values.tcp-route.yaml' ext-udp-routes: dependencies: - chart: bedag/raw diff --git a/helmfiles/applications.yaml b/helmfiles/applications.yaml index e03e226..ed05aad 100644 --- a/helmfiles/applications.yaml +++ b/helmfiles/applications.yaml @@ -4,6 +4,10 @@ bases: repositories: - name: gitea url: https://dl.gitea.io/charts/ + - name: bedag + url: https://bedag.github.io/helm-charts/ + - name: minecraft + url: https://itzg.github.io/minecraft-server-charts/ releases: - name: app-gitea @@ -13,3 +17,12 @@ releases: inherit: - template: env-values - template: env-secrets + + - name: minecraft + chart: minecraft/minecraft + namespace: games + version: 4.26.1 + inherit: + - template: common-values-tpl + - template: env-values + - template: env-secrets diff --git a/values/badhouseplants/secrets.minecraft.yaml b/values/badhouseplants/games/minecraft/secrets.yaml similarity index 100% rename from values/badhouseplants/secrets.minecraft.yaml rename to values/badhouseplants/games/minecraft/secrets.yaml diff --git a/values/badhouseplants/values.minecraft.yaml b/values/badhouseplants/games/minecraft/values.yaml similarity index 67% rename from values/badhouseplants/values.minecraft.yaml rename to values/badhouseplants/games/minecraft/values.yaml index 6fb1065..992e719 100644 --- a/values/badhouseplants/values.minecraft.yaml +++ b/values/badhouseplants/games/minecraft/values.yaml @@ -1,33 +1,15 @@ -service-account: - enabled: true - resources: - - name: minecraft-exporter - label: - app: minecraft-minecraft-metrics - endpoints: - port: metrics -traefik: - enabled: true - tcpRoutes: - - name: minecraft-tcp - entrypoint: minecraft - gateway: istio-system/badhouseplants-minecraft - match: HostSNI(`*`) - service: minecraft - port: 25565 # -------------------------------------------------- # -- Main values # -------------------------------------------------- image: - #tag: java21-graalvm - tag: java21-jdk + tag: java23-graalvm pullPolicy: Always resources: requests: - memory: 3.5Gi + memory: 2.5Gi cpu: 2.5 limits: - memory: 3.5Gi + memory: 2.5Gi lifecycle: postStart: - bash @@ -52,11 +34,11 @@ readinessProbe: successThreshold: 1 timeoutSeconds: 20 minecraftServer: - memory: 3000M + memory: 2000M jvmOpts: | -server jvmXXOpts: | - -Xms3000G -Xmx3500G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M + -Xms2000G -Xmx2500G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M overrideServerProperties: true eula: "TRUE" onlineMode: false @@ -89,7 +71,6 @@ minecraftServer: enabled: false persistence: storageClass: openebs-hostpath - #storageClass: local-path dataDir: enabled: true Size: 9Gi @@ -112,35 +93,6 @@ mcbackup: persistence: backupDir: enabled: false -# --------------------------------------------- -# -- Install Plugins -# --------------------------------------------- -initContainers: - - name: 0-download-mods - image: alpine/curl - command: - - curl - - -L - - "https://s3.badhouseplants.net/minecraft-mods/server_mods.tar" - - -o - - /download/server_mods.tar - volumeMounts: - - name: download - mountPath: /download - readOnly: false - - name: 1-copy-plugins-to-minecraft - image: ubuntu - command: - - sh - - -c - - cd /mods && tar -xvf /download/server_mods.tar || true - volumeMounts: - - name: plugins - mountPath: /mods - readOnly: false - - name: download - mountPath: /download - readOnly: false extraVolumes: - volumeMounts: - name: plugins @@ -171,3 +123,18 @@ extraDeploy: selector: matchLabels: app.kubernetes.io/instance: minecraft + - |- + apiVersion: traefik.io/v1alpha1 + kind: IngressRouteTCP + metadata: + name: minecraft-tcp + spec: + entryPoints: + - minecraft + routes: + - match: HostSNI(`*`) + services: + - name: minecraft + nativeLB: true + port: 25565 + diff --git a/values/common/games/minecraft/values.gotmpl b/values/common/games/minecraft/values.gotmpl new file mode 100644 index 0000000..6e4be52 --- /dev/null +++ b/values/common/games/minecraft/values.gotmpl @@ -0,0 +1,33 @@ +image: + repository: {{ .Values.registry }}/itzg/minecraft-server + pullSecret: regcred + +# --------------------------------------------- +# -- Install Plugins +# --------------------------------------------- +initContainers: + - name: 0-download-mods + image: {{.Values.registry}}/alpine/curl + command: + - curl + - -L + - "https://s3.badhouseplants.net/minecraft-mods/server_mods.tar" + - -o + - /download/server_mods.tar + volumeMounts: + - name: download + mountPath: /download + readOnly: false + - name: 1-copy-plugins-to-minecraft + image: {{ .Values.registry }}/ubuntu + command: + - sh + - -c + - cd /mods && tar -xvf /download/server_mods.tar || true + volumeMounts: + - name: plugins + mountPath: /mods + readOnly: false + - name: download + mountPath: /download + readOnly: false