Skip to content

Commit

Permalink
Fix: Spawn protection setting bugged (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomascizeron authored Dec 13, 2024
1 parent 56360f3 commit 5eb6182
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 41 deletions.
2 changes: 1 addition & 1 deletion charts/mc-router/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: mc-router
version: 1.2.3
version: 1.2.4
appVersion: 1.20.0
home: https://github.com/itzg/mc-router
description: Routes Minecraft client connections to backend servers based upon the requested server address.
Expand Down
12 changes: 1 addition & 11 deletions charts/mc-router/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,7 @@ Create the name of the service account to use
Helper function for environment variables
*/}}
{{- define "mc-router.envMap" -}}
{{- if index . 1 }}
- name: {{ index . 0 }}
value: {{ index . 1 | quote }}
{{- end }}
{{- end }}

{{/*
Helper function for boolean environment variables
*/}}
{{- define "mc-router.envBoolMap" -}}
{{- if ne (toString (index . 1)) "default" }}
{{- if or (index . 1) (kindIs "float64" (index . 1)) (kindIs "bool" (index . 1)) }}
- name: {{ index . 0 }}
value: {{ index . 1 | quote }}
{{- end }}
Expand Down
12 changes: 6 additions & 6 deletions charts/mc-router/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- include "mc-router.envBoolMap" (list "IN_KUBE_CLUSTER" "true") }}
{{- include "mc-router.envMap" (list "IN_KUBE_CLUSTER" "true") }}
{{- include "mc-router.envMap" (list "API_BINDING" (printf ":%d" $apiPort)) }}
{{- include "mc-router.envMap" (list "PORT" $minecraftPort) }}

{{- with .Values.minecraftRouter }}
{{- include "mc-router.envBoolMap" (list "AUTO_SCALE_UP" .autoScaleUp.enabled) }}
{{- include "mc-router.envMap" (list "AUTO_SCALE_UP" .autoScaleUp.enabled) }}
{{- include "mc-router.envMap" (list "CONNECTION_RATE_LIMIT" .connectionRateLimit) }}
{{- include "mc-router.envMap" (list "CPU_PROFILE" .cpuProfilePath) }}
{{- include "mc-router.envBoolMap" (list "DEBUG" .debug.enabled) }}
{{- include "mc-router.envMap" (list "DEBUG" .debug.enabled) }}

{{- with .defaultServer }}
{{- include "mc-router.envMap" (list "DEFAULT" (printf "%s:%d" .host (.port | int))) }}
Expand All @@ -84,9 +84,9 @@ spec:
{{- end }}

{{- include "mc-router.envSecretMap" (list "NGROK_TOKEN" .ngrokToken.existingSecret .ngrokToken.tokenKey ) }}
{{- include "mc-router.envBoolMap" (list "SIMPLIFY_SRV" .simplifySrv) }}
{{- include "mc-router.envBoolMap" (list "USE_PROXY_PROTOCOL" .useProxyProtocol) }}
{{- include "mc-router.envBoolMap" (list "VERSION" .showVersion) }}
{{- include "mc-router.envMap" (list "SIMPLIFY_SRV" .simplifySrv) }}
{{- include "mc-router.envMap" (list "USE_PROXY_PROTOCOL" .useProxyProtocol) }}
{{- include "mc-router.envMap" (list "VERSION" .showVersion) }}
{{- end }}

{{- range $key, $value := .Values.extraEnv }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: minecraft
version: 4.23.3
version: 4.23.4
appVersion: SeeValues
home: https://minecraft.net/
description: Minecraft server
Expand Down
9 changes: 1 addition & 8 deletions charts/minecraft/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end -}}

{{- define "minecraft.envMap" }}
{{- if index . 1 }}
- name: {{ index . 0 }}
value: {{ index . 1 | quote }}
{{- end }}
{{- end }}

{{- define "minecraft.envBoolMap" }}
{{- if ne (toString (index . 1)) "default" }}
{{- if or (index . 1) (kindIs "float64" (index . 1)) (kindIs "bool" (index . 1)) }}
- name: {{ index . 0 }}
value: {{ index . 1 | quote }}
{{- end }}
Expand Down
28 changes: 14 additions & 14 deletions charts/minecraft/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ spec:
{{- end }}
{{- else if eq .Values.minecraftServer.type "CURSEFORGE" }}
{{- template "minecraft.envMap" list "CF_SERVER_MOD" .Values.minecraftServer.cfServerMod }}
{{- template "minecraft.envBoolMap" list "FTB_LEGACYJAVAFIXER" .Values.minecraftServer.ftbLegacyJavaFixer }}
{{- template "minecraft.envMap" list "FTB_LEGACYJAVAFIXER" .Values.minecraftServer.ftbLegacyJavaFixer }}
{{- end }}
{{- template "minecraft.envMap" list "VERSION" .Values.minecraftServer.version }}
{{- template "minecraft.envMap" list "DIFFICULTY" .Values.minecraftServer.difficulty }}
Expand All @@ -153,27 +153,27 @@ spec:
{{- template "minecraft.envMap" list "ICON" .Values.minecraftServer.icon }}
{{- template "minecraft.envMap" list "MAX_PLAYERS" .Values.minecraftServer.maxPlayers }}
{{- template "minecraft.envMap" list "MAX_WORLD_SIZE" .Values.minecraftServer.maxWorldSize }}
{{- template "minecraft.envBoolMap" list "ALLOW_NETHER" .Values.minecraftServer.allowNether }}
{{- template "minecraft.envBoolMap" list "ANNOUNCE_PLAYER_ACHIEVEMENTS" .Values.minecraftServer.announcePlayerAchievements }}
{{- template "minecraft.envBoolMap" list "ENABLE_COMMAND_BLOCK" .Values.minecraftServer.enableCommandBlock }}
{{- template "minecraft.envBoolMap" list "FORCE_GAMEMODE" .Values.minecraftServer.forcegameMode }}
{{- template "minecraft.envMap" list "ALLOW_NETHER" .Values.minecraftServer.allowNether }}
{{- template "minecraft.envMap" list "ANNOUNCE_PLAYER_ACHIEVEMENTS" .Values.minecraftServer.announcePlayerAchievements }}
{{- template "minecraft.envMap" list "ENABLE_COMMAND_BLOCK" .Values.minecraftServer.enableCommandBlock }}
{{- template "minecraft.envMap" list "FORCE_GAMEMODE" .Values.minecraftServer.forcegameMode }}
{{- if .Values.minecraftServer.forceReDownload }}
- name: FORCE_REDOWNLOAD
value: "TRUE"
{{- end }}
{{- template "minecraft.envBoolMap" list "GENERATE_STRUCTURES" .Values.minecraftServer.generateStructures }}
{{- template "minecraft.envBoolMap" list "HARDCORE" .Values.minecraftServer.hardcore }}
{{- template "minecraft.envMap" list "GENERATE_STRUCTURES" .Values.minecraftServer.generateStructures }}
{{- template "minecraft.envMap" list "HARDCORE" .Values.minecraftServer.hardcore }}
{{- template "minecraft.envMap" list "MAX_BUILD_HEIGHT" .Values.minecraftServer.maxBuildHeight }}
{{- template "minecraft.envMap" list "MAX_TICK_TIME" .Values.minecraftServer.maxTickTime }}
{{- template "minecraft.envBoolMap" list "SPAWN_ANIMALS" .Values.minecraftServer.spawnAnimals }}
{{- template "minecraft.envBoolMap" list "SPAWN_MONSTERS" .Values.minecraftServer.spawnMonsters }}
{{- template "minecraft.envBoolMap" list "SPAWN_NPCS" .Values.minecraftServer.spawnNPCs }}
{{- template "minecraft.envMap" list "SPAWN_ANIMALS" .Values.minecraftServer.spawnAnimals }}
{{- template "minecraft.envMap" list "SPAWN_MONSTERS" .Values.minecraftServer.spawnMonsters }}
{{- template "minecraft.envMap" list "SPAWN_NPCS" .Values.minecraftServer.spawnNPCs }}
{{- template "minecraft.envMap" list "SPAWN_PROTECTION" .Values.minecraftServer.spawnProtection }}
{{- template "minecraft.envMap" list "VIEW_DISTANCE" .Values.minecraftServer.viewDistance }}
{{- template "minecraft.envMap" list "SEED" .Values.minecraftServer.levelSeed }}
{{- template "minecraft.envMap" list "MODE" .Values.minecraftServer.gameMode }}
{{- template "minecraft.envMap" list "MOTD" .Values.minecraftServer.motd }}
{{- template "minecraft.envBoolMap" list "PVP" .Values.minecraftServer.pvp }}
{{- template "minecraft.envMap" list "PVP" .Values.minecraftServer.pvp }}
{{- template "minecraft.envMap" list "LEVEL_TYPE" .Values.minecraftServer.levelType }}
{{- template "minecraft.envMap" list "GENERATOR_SETTINGS" .Values.minecraftServer.generatorSettings }}
{{- template "minecraft.envMap" list "LEVEL" .Values.minecraftServer.worldSaveName }}
Expand Down Expand Up @@ -221,12 +221,12 @@ spec:
- name: RESOURCE_PACK_ENFORCE
value: "TRUE"
{{- end }}
{{- template "minecraft.envBoolMap" list "ONLINE_MODE" .Values.minecraftServer.onlineMode }}
{{- template "minecraft.envBoolMap" list "ENFORCE_SECURE_PROFILE" .Values.minecraftServer.enforceSecureProfile }}
{{- template "minecraft.envMap" list "ONLINE_MODE" .Values.minecraftServer.onlineMode }}
{{- template "minecraft.envMap" list "ENFORCE_SECURE_PROFILE" .Values.minecraftServer.enforceSecureProfile }}
{{- template "minecraft.envMap" list "MEMORY" .Values.minecraftServer.memory }}
{{- template "minecraft.envMap" list "JVM_OPTS" .Values.minecraftServer.jvmOpts }}
{{- template "minecraft.envMap" list "JVM_XX_OPTS" .Values.minecraftServer.jvmXXOpts }}
{{- template "minecraft.envBoolMap" list "OVERRIDE_SERVER_PROPERTIES" .Values.minecraftServer.overrideServerProperties }}
{{- template "minecraft.envMap" list "OVERRIDE_SERVER_PROPERTIES" .Values.minecraftServer.overrideServerProperties }}

{{- if .Values.minecraftServer.rcon.enabled }}
- name: ENABLE_RCON
Expand Down

0 comments on commit 5eb6182

Please sign in to comment.