fix(palworld) fix rcon sidecar and update docs and update probes (#17776)

**Description**
- Fixes rcon sidecar
- mount a default file to persist the creds and host for the rcon
command tool
- updates docs
- update probes
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [X] 🪛 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
- [X] 📄 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 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>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97TheNoob 2024-02-04 01:42:22 -05:00 committed by GitHub
parent 27c4a98f62
commit 56386e75b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 162 additions and 39 deletions

View File

@ -35,4 +35,4 @@ sources:
- https://ghcr.io/ich777/steamcmd
- https://hub.docker.com/r/outdead/rcon
type: application
version: 0.1.3
version: 0.1.4

View File

@ -2,12 +2,18 @@
title: PalWorld Installation Notes
---
::: note
:::note
All app configuration defined in the GUI will take precedence over ANY manual configuration changed via the ini file.
:::
:::info
You may need to restart the chart every 24 to 48hrs to keep the server from running out of memory and crashing.
:::
## Default Values
| KEY | VALUE |

View File

@ -4,7 +4,19 @@ 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.
::: note
A single command:
```shell
./rcon info
```
A interactive shell:
```shell
./rcon
```
:::note
To use the same commands while in game;
type in chat:

View File

@ -0,0 +1,9 @@
---
title: PalWorld Update Notes
---
:::note
To update the server; restart the chart, it will download the latest available version when present. Highly recommend to checkout [rocn docs](./rcon_notes.md) to save the game prior to restarting it.
:::

View File

@ -391,6 +391,42 @@ questions:
schema:
type: boolean
default: false
- variable: public_ip
label: Public IP
schema:
type: string
default: ""
show_if: [[update_public_ip, "!=", "true"]]
- variable: params
label: Game Params
schema:
type: list
default:
- EpicApp=PalServer
required: true
items:
- variable: param
label: Param
schema:
type: string
required: true
default: ""
- variable: params_extra
label: Game Params Extra
schema:
type: list
default:
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
required: true
items:
- variable: extra_param
label: Extra Param
schema:
type: string
required: true
default: ""
- variable: backup
label: Backup Configuration
schema:
@ -419,27 +455,32 @@ questions:
min: 1
# Include{containerConfig}
# Include{podOptions}
# Include{serviceRoot}
# Include{serviceMain}
- variable: main
label: Main Service
description: The Primary service on which the healthcheck runs, often the webUI
schema:
additional_attrs: true
type: dict
attrs:
# Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras}
- variable: main
label: "Main Service Port Configuration"
label: Main Service Port Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: port
label: "Port"
description: "This port exposes the container port on the service"
label: Port
description: This port exposes the container port on the service
schema:
type: int
default: 8211
required: true
- variable: rcon
label: RCON Service
description: The RCON service.
label: RCON service
description: RCON Service Port Configuration
schema:
additional_attrs: true
type: dict

View File

@ -0,0 +1,17 @@
{{/* 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 }}
palworld-rcon:
enabled: true
data:
rcon.yaml: |
default:
address: "{{ printf "%v-rcon:%v" $fullname $rconPort }}"
password: {{ $adminPassword }}
log: "rcon-palworld.log"
timeout: "10s"
{{- end -}}

View File

@ -1 +1,11 @@
{{ include "tc.v1.common.loader.all" . }}
{{/* 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 -}}
{{/* Render the templates */}}
{{- include "tc.v1.common.loader.apply" . -}}

View File

@ -93,6 +93,7 @@ palworld:
region: ""
work_speed_rate: "1.000000"
update_public_ip: false
public_ip: ""
params:
- EpicApp=PalServer
params_extra:
@ -120,6 +121,7 @@ workload:
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 }}"
mkdir -p ${config}
if [ ! -f "${cfgFile}" ]; then
@ -134,24 +136,43 @@ workload:
fi
set_ini_value() {
local key="${1}"
local value="${2}"
local quote_flag="${3:-}"
local key="${1}"
local value="${2}"
local quote_flag="${3:-}"
# Check if the key exists
if ! grep -q "${key}=" "${cfgFile}"; then
echo "Key '${key}' does not exist in '${cfgFile}'. Skipping..."
return
fi
# 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
if [ "$quote_flag" = "-q" ]; then
# Add quotes around the value
value="\"$value\""
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 "Setting ${key}..."
sed -i "s|\(${key}=\)[^,]*|\1${value}|g" "${cfgFile}"
echo "Set to $(grep -Po "(?<=${key}=)[^,]*" "${cfgFile}")"
# Add quotes around the value if quote_flag is set
if [ "$quote_flag" = "-q" ]; then
value="\"$value\""
fi
# Update the value within the OptionSettings section
sed -i "/OptionSettings=(/ {
:loop
/)$/! {
N
b loop
}
s|\(${key}=\)[^,]*|\1${value}|
}" "${cfgFile}"
# Check if the closing parenthesis is missing, and if so, add it
if ! grep -q ')$' "${cfgFile}"; then
sed -i "\|OptionSettings=(| s|$|)|" "${cfgFile}"
fi
echo "Set ${key} to ${value}"
}
echo "the following options are updating...."
@ -160,15 +181,15 @@ workload:
set_ini_value "RCONPort" "{{ .Values.service.rcon.ports.rcon.port }}" -q
set_ini_value "PublicPort" "{{ .Values.service.main.ports.main.port }}" -q
set_ini_value "ServerPassword" "{{ .Values.palworld.game.password }}" -q
set_ini_value "AdminPassword" "{{ .Values.palworld.game.admin_password }}" -q
set_ini_value "ServerPassword" '{{ .Values.palworld.game.password }}' -q
set_ini_value "AdminPassword" '{{ .Values.palworld.game.admin_password }}' -q
set_ini_value "ServerName" "{{ .Values.palworld.game.name }}" -q
set_ini_value "ServerDescription" "{{ .Values.palworld.game.description }}" -q
set_ini_value "ServerName" '{{ .Values.palworld.game.name }}' -q
set_ini_value "ServerDescription" '{{ .Values.palworld.game.description }}' -q
set_ini_value "Difficulty" "{{ .Values.palworld.game.difficulty }}" -q
set_ini_value "DeathPenalty" "{{ .Values.palworld.game.death_penalty }}" -q
set_ini_value "Region" "{{ .Values.palworld.game.region }}" -q
set_ini_value "AutoResetGuildTimeNoOnlinePlayers" "{{ .Values.palworld.game.auto_reset_guild_time_no_online_players }}"
set_ini_value "BaseCampMaxNum" "{{ .Values.palworld.game.base_camp_max }}"
set_ini_value "BaseCampWorkerMaxNum" "{{ .Values.palworld.game.base_camp_worker_max }}"
@ -221,6 +242,10 @@ workload:
set_ini_value "WorkSpeedRate" "{{ .Values.palworld.game.work_speed_rate }}"
set_ini_value "ExpRate" "{{ .Values.palworld.game.exp_rate }}"
# Check if update_public_ip is not true
if [ "${update_public_ip}" != "true" ]; then
set_ini_value "PublicIP" "{{ .Values.palworld.game.public_ip }}" -q
fi
echo "Done!"
containers:
main:
@ -245,7 +270,7 @@ workload:
VALIDATE: "{{ .Values.palworld.steam.validate }}"
# game
SRV_ADMIN_PWD: "{{ .Values.palworld.game.admin_password }}"
UPDATE_PUBLIC_IP: "{{ .Values.palworld.game.update_public_ip }}"
UPDATE_PUBLIC_IP: "{{ .Values.palworld.game.update_public_ip }}"
GAME_PARAMS: '{{ join " " .Values.palworld.game.params }}'
GAME_PARAMS_EXTRA: '{{ join " " .Values.palworld.game.params_extra }}'
# backup
@ -272,12 +297,6 @@ workload:
enabled: false
startup:
enabled: false
args:
- ./rcon
- -a
- '{{ printf "%v-rcon:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.rcon.ports.rcon.port }}'
- -p
- "{{ .Values.palworld.game.admin_password }}"
persistence:
steamcmd:
@ -291,7 +310,16 @@ 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:
enabled: false