fix(palworld) restructure palworld's chart **breaking changes** (#28384)

**Description**
Remove the rcon sidecar, restructured the palworld.game section to use
the actual key for the palworld ini file.


⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [X] ⚠️ 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
- [X] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

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

- [ ] 🖼️ 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>
This commit is contained in:
Xstar97TheNoob
2024-10-28 12:03:33 +01:00
committed by GitHub
parent b07bafe677
commit 9a6e098e07
6 changed files with 114 additions and 350 deletions
+1 -1
View File
@@ -34,4 +34,4 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/stable/palworld
- https://hub.docker.com/r/outdead/rcon
type: application
version: 4.2.1
version: 5.0.0
-50
View File
@@ -1,50 +0,0 @@
---
title: PalWorld RCON Notes
---
Shell into the app from the web gui or use heavyscript and select the RCON container; the following commands can be used.
A single command:
```shell
./rcon info
```
A interactive shell:
```shell
./rcon
```
:::note
To use the same commands while in game;
type in chat:
/AdminPassword PASSWORD
then run the commands in chat
ex: /Info
:::
## RCON Commands
| Command | Description |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------ |
| /Shutdown {Seconds} {MessageText} | Gracefully shuts down server with an optional timer and/or message to notify players in your server. |
| /DoExit | Forcefully shuts down the server immediately. It is not recommended to use this option |
| /Broadcast {MessageText} | Broadcasts a message to all players in the server. |
| /KickPlayer {PlayerUID or SteamID} | Kicks player from the server. Useful for getting a player's attention with moderation. |
| /BanPlayer {PlayerUID or SteamID} | Bans player from the server. The Player will not be able to rejoin the server until they are unbanned. |
| /ShowPlayers | Shows information on all connected players. |
| /Info | Shows server information. |
| /Save | Save the world data to disk. |
## In-Game Only Commands
| Command | Description |
| ---------------------------------------- | ------------------------------------------- |
| /TeleportToPlayer {PlayerUID or SteamID} | Immediately teleport to the target player. |
| /TeleportToMe {PlayerUID or SteamID} | Immediately teleports target player to you. |
-19
View File
@@ -1,19 +0,0 @@
---
title: Input Validation
---
**`floats`**
Accepted formats are:
- `1.0000`
- `10.0000`
- `100.0000`
- `1000.0000`
- etc
Regex used to match this: `^\d{1,}\.[0-9]{6}$`
You can try live [here](https://regex101.com/r/BTJv6n/1)
---
_If you find a field that you think it needs validation, please open an issue on github_
@@ -1,18 +0,0 @@
{{/* Define the configmap */}}
{{- define "palworld.configmaps" -}}
{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}}
{{- $adminPassword := .Values.palworld.game.admin_password -}}
{{- $rconPort := .Values.service.rcon.ports.rcon.port }}
{{- $rcon := .Values.palworld.rcon }}
palworld-rcon:
enabled: true
data:
rcon.yaml: |
default:
address: "{{ printf "%v-rcon:%v" $fullname $rconPort }}"
password: {{ $adminPassword }}
log: "rcon-palworld.log"
timeout: "{{ $rcon.timeout }}"
{{- end -}}
@@ -1,17 +1,5 @@
{{/* Make sure all variables are set properly */}}
{{- include "tc.v1.common.loader.init" . -}}
{{/* Render configmaps for all pods */}}
{{- $configmaps := include "palworld.configmaps" . | fromYaml -}}
{{- if $configmaps -}}
{{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}}
{{- end -}}
{{/* Disable [rcon] if requested */}}
{{- if not .Values.palworld.rcon.enabled -}}
{{- $_ := set .Values.workload.rcon "enabled" false -}}
{{- end -}}
{{/* Render the templates */}}
{{- include "tc.v1.common.loader.apply" . -}}
+112 -249
View File
@@ -2,10 +2,6 @@ image:
repository: ghcr.io/ich777/steamcmd
pullPolicy: IfNotPresent
tag: palworld@sha256:e1ba071929359d54b1a9e139f62d90f30ff0ab9fce1d2093d28f9bd82dbe9913
rconImage:
repository: docker.io/outdead/rcon
pullPolicy: IfNotPresent
tag: latest@sha256:f4ab6d4f86525e2d71534b839cc4e2241ffc9278759f7a70ef3aa434c5aec927
securityContext:
container:
@@ -19,6 +15,13 @@ service:
main:
protocol: udp
port: 8211
api:
enabled: true
ports:
api:
enabled: true
protocol: tcp
port: 8212
rcon:
enabled: true
ports:
@@ -26,7 +29,6 @@ service:
enabled: true
protocol: tcp
port: 25575
palworld:
steam:
id: "2394010"
@@ -34,79 +36,24 @@ palworld:
password: ""
validate: false
game:
name: "TrueCharts Palworld Server"
description: "A Palworld Server running in Kubernetes"
use_auth: true
password: ""
admin_password: ""
auto_reset_guild_time_no_online_players: "72.000000"
ban_list_url: "https://api.palworldgame.com/api/banlist.txt"
base_camp_max: 128
base_camp_worker_max: 15
build_object_damage_rate: "1.000000"
build_object_deterioration_damage_rate: "1.000000"
can_pickup_other_guild_death_penalty_drop: false
collection_drop_rate: "1.000000"
collection_object_hp_rate: "1.000000"
collection_object_respawn_speed_rate: "1.000000"
day_time_speed_rate: "1.000000"
death_penalty: "ALL"
difficulty: "None"
drop_item_alive_max_hours: "1.000000"
drop_item_max: 3000
drop_item_max_unko: 100
enable_aim_assist_kb: false
enable_aim_assist_pad: false
enable_defense_other_guild_player: true
enable_fast_travel: true
enable_friendly_fire: false
enable_invader_enemy: true
active_unko: false
enable_non_login_penalty: true
enable_pvp_damage: false
exist_players_after_logout: true
enemy_drop_item_rate: "1.000000"
exp_rate: "1.000000"
guild_auto_reset_no_online_players: false
is_multiplay: false
is_pvp: false
is_start_location_select_by_map: true
max_players: 32
max_players_coop: 4
max_players_guild: 20
night_time_speed_rate: "1.000000"
pal_auto_hp_regene_rate: "1.000000"
pal_auto_hp_regene_rate_in_sleep: "1.000000"
pal_capture_rate: "1.000000"
pal_damage_rate_attack: "1.000000"
pal_damage_rate_defense: "1.000000"
pal_egg_default_hatching_time: "72.000000"
pal_spawn_num_rate: "1.000000"
pal_stamina_decreace_rate: "1.000000"
pal_stomach_decreace_rate: "1.000000"
player_auto_hp_regene_rate: "1.000000"
player_auto_hp_regene_rate_in_sleep: "1.000000"
player_damage_rate_attack: "1.000000"
player_damage_rate_defense: "1.000000"
player_stamina_decreace_rate: "1.000000"
player_stomach_decreace_rate: "1.000000"
region: ""
work_speed_rate: "1.000000"
update_public_ip: false
public_ip: ""
params:
- -publiclobby
params_extra:
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
ServerName: "TrueCharts Palworld Server"
ServerDescription: "A Palworld Server running in Kubernetes"
ServerPassword: ""
AdminPassword: "TrueChartsIsAHelmProject"
bUseAuth: true
# PublicIP: "my public IP"
# AllowConnectPlatform: "Steam|Xbox"
update_public_ip: false
params:
- -publiclobby
params_extra:
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
backup:
enabled: true
interval: 120
to_keep: 12
rcon:
enabled: true
timeout: 10s
workload:
main:
@@ -121,163 +68,109 @@ workload:
- -c
args:
- |
config={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/Pal/Saved/Config/LinuxServer
cfgFile=${config}/PalWorldSettings.ini
dfCfgFile={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/DefaultPalWorldSettings.ini
update_public_ip="{{ .Values.palworld.game.update_public_ip }}"
serverfiles={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}
config=${serverfiles}/Pal/Saved/Config/LinuxServer
cfgFile=${config}/PalWorldSettings.ini
dfCfgFile=${serverfiles}/DefaultPalWorldSettings.ini
mkdir -p ${config}
if [ ! -f "${cfgFile}" ]; then
if [ -f "${dfCfgFile}" ]; then
echo "Default config file found, copying as cfgFile..."
cp "${dfCfgFile}" "${cfgFile}"
else
echo "Config file not found, fetching..."
# Fetch the config file if it doesn't exist, just like the container does
wget -qO "${cfgFile}" https://github.com/ich777/docker-steamcmd-server/raw/palworld/config/PalWorldSettings.ini
fi
fi
set_ini() {
local key="${1}"
local value="${2}"
local flags="" # Initialize an empty string for flags
# Loop through arguments starting from the third one
for arg in "$@"; do
if [ "$arg" != "$key" ] && [ "$arg" != "$value" ]; then
flags="$flags $arg" # Append each flag to the flags string
mkdir -p ${config}
if [ ! -f "${cfgFile}" ]; then
if [ -f "${dfCfgFile}" ]; then
echo "Default config file found, copying as cfgFile..."
cp "${dfCfgFile}" "${cfgFile}"
else
echo "Config file not found, fetching..."
# Fetch the config file if it doesn't exist, just like the container does
wget -qO "${cfgFile}" https://github.com/ich777/docker-steamcmd-server/raw/palworld/config/PalWorldSettings.ini
fi
done
# Check if the key exists in the OptionSettings section
if ! grep -q 'OptionSettings=(' "$cfgFile"; then
echo "OptionSettings section not found in '${cfgFile}'. Skipping..."
return
fi
# Check if the key exists within the OptionSettings section
if ! grep -q "${key}=" "$cfgFile"; then
echo "Key '${key}' does not exist in the OptionSettings section of '${cfgFile}'. Skipping..."
return
fi
set_ini() {
local key="${1}"
local value="${2}"
local flags="" # Initialize an empty string for flags
# Iterate over flags
for flag in $flags; do
case $flag in
-q)
# Add quotes around the value
value="\"$value\""
;;
-b)
# Handle boolean flag
if [ "$(echo "$value" | tr '[:upper:]' '[:lower:]')" = "true" ]; then
value="True"
else
value="False"
fi
;;
*)
echo "Unknown flag: $flag. Skipping..."
;;
esac
done
# Loop through arguments starting from the third one
for arg in "$@"; do
if [ "$arg" != "$key" ] && [ "$arg" != "$value" ]; then
flags="$flags $arg" # Append each flag to the flags string
fi
done
# Update the value within the OptionSettings section
sed -i "/OptionSettings=(/ {
:loop
/)$/! {
N
b loop
}
s|\(${key}=\)[^,]*|\1${value}|
}" "${cfgFile}"
# Check if the key exists in the OptionSettings section
if ! grep -q 'OptionSettings=(' "$cfgFile"; then
echo "OptionSettings section not found in '${cfgFile}'. Skipping..."
return
fi
# Check if the closing parenthesis is missing, and if so, add it
if ! grep -q ')$' "${cfgFile}"; then
sed -i "\|OptionSettings=(| s|$|)|" "${cfgFile}"
fi
# Check if the key exists within the OptionSettings section
if ! grep -q "${key}=" "$cfgFile"; then
echo "Key '${key}' does not exist in the OptionSettings section of '${cfgFile}'. Skipping..."
return
fi
echo "Set ${key} to ${value}"
}
# Iterate over flags
for flag in $flags; do
case $flag in
-q)
# Add quotes around the value
value="\"$value\""
;;
-b)
# Handle boolean flag
if [ "$(echo "$value" | tr '[:upper:]' '[:lower:]')" = "true" ]; then
value="True"
else
value="False"
fi
;;
*)
echo "Unknown flag: $flag. Skipping..."
;;
esac
done
echo "the following options are updating...."
# Update the value within the OptionSettings section
sed -i "/OptionSettings=(/ {
:loop
/)$/! {
N
b loop
}
s|\(${key}=\)[^,]*|\1${value}|
}" "${cfgFile}"
set_ini "RCONEnabled" "True" -b
# Check if the closing parenthesis is missing, and if so, add it
if ! grep -q ')$' "${cfgFile}"; then
sed -i "\|OptionSettings=(| s|$|)|" "${cfgFile}"
fi
set_ini "RCONPort" "{{ .Values.service.rcon.ports.rcon.port }}"
set_ini "PublicPort" "{{ .Values.service.main.ports.main.port }}"
echo "Set ${key} to ${value}"
}
set_ini "ServerPassword" '{{ .Values.palworld.game.password }}' -q
set_ini "AdminPassword" '{{ .Values.palworld.game.admin_password }}' -q
echo "the following options are updating...."
set_ini "ServerName" '{{ .Values.palworld.game.name }}' -q
set_ini "ServerDescription" '{{ .Values.palworld.game.description }}' -q
set_ini "Difficulty" "{{ .Values.palworld.game.difficulty }}" -q
set_ini "DeathPenalty" "{{ .Values.palworld.game.death_penalty }}" -q
set_ini "Region" "{{ .Values.palworld.game.region }}" -q
set_ini "RCONEnabled" "True" -b
set_ini "AutoResetGuildTimeNoOnlinePlayers" "{{ .Values.palworld.game.auto_reset_guild_time_no_online_players }}"
set_ini "BaseCampMaxNum" "{{ .Values.palworld.game.base_camp_max }}"
set_ini "BaseCampWorkerMaxNum" "{{ .Values.palworld.game.base_camp_worker_max }}"
set_ini "BanListURL" "{{ .Values.palworld.game.ban_list_url }}" -q
set_ini "BuildObjectDamageRate" "{{ .Values.palworld.game.build_object_damage_rate }}"
set_ini "BuildObjectDeteriorationDamageRate" "{{ .Values.palworld.game.build_object_deterioration_damage_rate }}"
set_ini "RCONPort" "{{ .Values.service.rcon.ports.rcon.port }}"
set_ini "PublicPort" "{{ .Values.service.main.ports.main.port }}"
set_ini "RESTAPIEnabled" "True" -b
set_ini "RESTAPIPort" "{{ .Values.service.api.ports.api.port }}"
set_ini "bCanPickupOtherGuildDeathPenaltyDrop" "{{ .Values.palworld.game.can_pickup_other_guild_death_penalty_drop }}" -b
set_ini "bUseAuth" "{{ .Values.palworld.game.use_auth }}" -b
set_ini "bEnablePlayerToPlayerDamage" "{{ .Values.palworld.game.enable_pvp_damage }}" -b
set_ini "bEnableFriendlyFire" "{{ .Values.palworld.game.enable_friendly_fire }}" -b
set_ini "bEnableInvaderEnemy" "{{ .Values.palworld.game.enable_invader_enemy }}" -b
set_ini "bEnableAimAssistPad" "{{ .Values.palworld.game.enable_aim_assist_pad }}" -b
set_ini "bEnableAimAssistKeyboard" "{{ .Values.palworld.game.enable_aim_assist_kb }}" -b
set_ini "bEnableNonLoginPenalty" "{{ .Values.palworld.game.enable_non_login_penalty }}" -b
set_ini "bEnableFastTravel" "{{ .Values.palworld.game.enable_fast_travel }}" -b
set_ini "bEnableDefenseOtherGuildPlayer" "{{ .Values.palworld.game.enable_defense_other_guild_player }}" -b
set_ini "bIsMultiplay" "{{ .Values.palworld.game.is_multiplay }}" -b
set_ini "bIsStartLocationSelectByMap" "{{ .Values.palworld.game.is_start_location_select_by_map }}" -b
set_ini "bIsPvP" "{{ .Values.palworld.game.is_pvp }}" -b
set_ini "bExistPlayerAfterLogout" "{{ .Values.palworld.game.exist_players_after_logout }}" -b
set_ini "bActiveUNKO" "{{ .Values.palworld.game.active_unko }}" -b
set_ini "bAutoResetGuildNoOnlinePlayers" "{{ .Values.palworld.game.guild_auto_reset_no_online_players }}" -b
set_ini "CollectionDropRate" "{{ .Values.palworld.game.collection_drop_rate }}"
set_ini "CollectionObjectHpRate" "{{ .Values.palworld.game.collection_object_hp_rate }}"
set_ini "CollectionObjectRespawnSpeedRate" "{{ .Values.palworld.game.collection_object_respawn_speed_rate }}"
set_ini "CoopPlayerMaxNum" "{{ .Values.palworld.game.max_players_coop }}"
set_ini "DayTimeSpeedRate" "{{ .Values.palworld.game.day_time_speed_rate }}"
set_ini "DropItemMaxNum" "{{ .Values.palworld.game.drop_item_max }}"
set_ini "DropItemMaxNum_UNKO" "{{ .Values.palworld.game.drop_item_max_unko }}"
set_ini "DropItemAliveMaxHours" "{{ .Values.palworld.game.drop_item_alive_max_hours }}"
set_ini "EnemyDropItemRate" "{{ .Values.palworld.game.enemy_drop_item_rate }}"
set_ini "GuildPlayerMaxNum" "{{ .Values.palworld.game.max_players_guild }}"
set_ini "NightTimeSpeedRate" "{{ .Values.palworld.game.night_time_speed_rate }}"
set_ini "PalCaptureRate" "{{ .Values.palworld.game.pal_capture_rate }}"
set_ini "PalEggDefaultHatchingTime" "{{ .Values.palworld.game.pal_egg_default_hatching_time }}"
set_ini "PalSpawnNumRate" "{{ .Values.palworld.game.pal_spawn_num_rate }}"
set_ini "PalDamageRateAttack" "{{ .Values.palworld.game.pal_damage_rate_attack }}"
set_ini "PalDamageRateDefense" "{{ .Values.palworld.game.pal_damage_rate_defense }}"
set_ini "PlayerDamageRateAttack" "{{ .Values.palworld.game.player_damage_rate_attack }}"
set_ini "PlayerDamageRateDefense" "{{ .Values.palworld.game.player_damage_rate_defense }}"
set_ini "PlayerStomachDecreaceRate" "{{ .Values.palworld.game.player_stomach_decreace_rate }}"
set_ini "PlayerStaminaDecreaceRate" "{{ .Values.palworld.game.player_stamina_decreace_rate }}"
set_ini "PlayerAutoHPRegeneRate" "{{ .Values.palworld.game.player_auto_hp_regene_rate }}"
set_ini "PlayerAutoHpRegeneRateInSleep" "{{ .Values.palworld.game.player_auto_hp_regene_rate_in_sleep }}"
set_ini "PalStomachDecreaceRate" "{{ .Values.palworld.game.pal_stomach_decreace_rate }}"
set_ini "PalStaminaDecreaceRate" "{{ .Values.palworld.game.pal_stamina_decreace_rate }}"
set_ini "PalAutoHPRegeneRate" "{{ .Values.palworld.game.pal_auto_hp_regene_rate }}"
set_ini "PalAutoHpRegeneRateInSleep" "{{ .Values.palworld.game.pal_auto_hp_regene_rate_in_sleep }}"
set_ini "ServerPlayerMaxNum" "{{ .Values.palworld.game.max_players }}"
set_ini "WorkSpeedRate" "{{ .Values.palworld.game.work_speed_rate }}"
set_ini "ExpRate" "{{ .Values.palworld.game.exp_rate }}"
# Check if update_public_ip is not true
if [ "${update_public_ip}" != "true" ]; then
set_ini "PublicIP" "{{ .Values.palworld.game.public_ip }}" -q
fi
echo "Done!"
{{- range $key, $value := .Values.palworld.game }}
{{- $numRegex := "^[0-9]+([.][0-9]+)?$" -}}
{{- $boolRegex := "^(true|false)$" -}}
{{- $valueStr := toString $value -}}
{{- if (mustRegexMatch $numRegex $valueStr) }}
set_ini "{{ $key }}" {{ $value }}
{{- else if (mustRegexMatch $boolRegex (lower $valueStr)) }}
set_ini "{{ $key }}" {{ $valueStr | title }} -b
{{- else }}
set_ini "{{ $key }}" {{ quote $valueStr }} -q
{{- end }}
{{- end }}
echo "Done!"
containers:
main:
probes:
@@ -300,34 +193,14 @@ workload:
PASSWRD: "{{ .Values.palworld.steam.password }}"
VALIDATE: "{{ .Values.palworld.steam.validate }}"
# game
SRV_ADMIN_PWD: "{{ .Values.palworld.game.admin_password }}"
UPDATE_PUBLIC_IP: "{{ .Values.palworld.game.update_public_ip }}"
GAME_PARAMS: '{{ printf "-port=%v -publicport=%v -rconport=%v %s" .Values.service.main.ports.main.port .Values.service.main.ports.main.port .Values.service.rcon.ports.rcon.port (join " " .Values.palworld.game.params) }}'
GAME_PARAMS_EXTRA: '{{ join " " .Values.palworld.game.params_extra }}'
SRV_ADMIN_PWD: "{{ .Values.palworld.game.AdminPassword }}"
UPDATE_PUBLIC_IP: "{{ .Values.palworld.update_public_ip }}"
GAME_PARAMS: '{{ printf "-port=%v -publicport=%v -rconport=%v %s" .Values.service.main.ports.main.port .Values.service.main.ports.main.port .Values.service.rcon.ports.rcon.port (join " " .Values.palworld.params) }}'
GAME_PARAMS_EXTRA: '{{ join " " .Values.palworld.params_extra }}'
# backup
BACKUP: "{{ .Values.palworld.backup.enabled }}"
BACKUP_INTERVAL: "{{ .Values.palworld.backup.interval }}"
BACKUP_TO_KEEP: "{{ .Values.palworld.backup.to_keep }}"
rcon:
enabled: true
type: Deployment
strategy: RollingUpdate
replicas: 1
podSpec:
containers:
rcon:
primary: true
enabled: true
imageSelector: rconImage
tty: true
stdin: true
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false
persistence:
steamcmd:
@@ -341,16 +214,6 @@ persistence:
mountPath: /serverdata/serverfiles
update-config-ini:
mountPath: /serverdata/serverfiles
palworld-rcon:
enabled: true
type: configmap
objectName: palworld-rcon
targetSelector:
rcon:
rcon:
mountPath: /rcon.yaml
subPath: rcon.yaml
readOnly: true
portal:
open: