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://ghcr.io/ich777/steamcmd
- https://hub.docker.com/r/outdead/rcon - https://hub.docker.com/r/outdead/rcon
type: application type: application
version: 0.1.3 version: 0.1.4

View File

@ -2,12 +2,18 @@
title: PalWorld Installation Notes 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. 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 ## Default Values
| KEY | VALUE | | 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. 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; To use the same commands while in game;
type in chat: 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: schema:
type: boolean type: boolean
default: false 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 - variable: backup
label: Backup Configuration label: Backup Configuration
schema: schema:
@ -419,27 +455,32 @@ questions:
min: 1 min: 1
# Include{containerConfig} # Include{containerConfig}
# Include{podOptions}
# Include{serviceRoot} # 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{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras} # Include{serviceSelectorExtras}
- variable: main - variable: main
label: "Main Service Port Configuration" label: Main Service Port Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: port - variable: port
label: "Port" label: Port
description: "This port exposes the container port on the service" description: This port exposes the container port on the service
schema: schema:
type: int type: int
default: 8211 default: 8211
required: true required: true
- variable: rcon - variable: rcon
label: RCON Service label: RCON service
description: The RCON service. description: RCON Service Port Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict 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: "" region: ""
work_speed_rate: "1.000000" work_speed_rate: "1.000000"
update_public_ip: false update_public_ip: false
public_ip: ""
params: params:
- EpicApp=PalServer - EpicApp=PalServer
params_extra: params_extra:
@ -120,6 +121,7 @@ workload:
config={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/Pal/Saved/Config/LinuxServer config={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/Pal/Saved/Config/LinuxServer
cfgFile=${config}/PalWorldSettings.ini cfgFile=${config}/PalWorldSettings.ini
dfCfgFile={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/DefaultPalWorldSettings.ini dfCfgFile={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/DefaultPalWorldSettings.ini
update_public_ip="{{ .Values.palworld.game.update_public_ip }}"
mkdir -p ${config} mkdir -p ${config}
if [ ! -f "${cfgFile}" ]; then if [ ! -f "${cfgFile}" ]; then
@ -134,24 +136,43 @@ workload:
fi fi
set_ini_value() { set_ini_value() {
local key="${1}" local key="${1}"
local value="${2}" local value="${2}"
local quote_flag="${3:-}" local quote_flag="${3:-}"
# Check if the key exists # Check if the key exists in the OptionSettings section
if ! grep -q "${key}=" "${cfgFile}"; then if ! grep -q 'OptionSettings=(' "$cfgFile"; then
echo "Key '${key}' does not exist in '${cfgFile}'. Skipping..." echo "OptionSettings section not found in '${cfgFile}'. Skipping..."
return return
fi fi
if [ "$quote_flag" = "-q" ]; then # Check if the key exists within the OptionSettings section
# Add quotes around the value if ! grep -q "${key}=" "$cfgFile"; then
value="\"$value\"" echo "Key '${key}' does not exist in the OptionSettings section of '${cfgFile}'. Skipping..."
fi return
fi
echo "Setting ${key}..." # Add quotes around the value if quote_flag is set
sed -i "s|\(${key}=\)[^,]*|\1${value}|g" "${cfgFile}" if [ "$quote_flag" = "-q" ]; then
echo "Set to $(grep -Po "(?<=${key}=)[^,]*" "${cfgFile}")" 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...." echo "the following options are updating...."
@ -160,11 +181,11 @@ workload:
set_ini_value "RCONPort" "{{ .Values.service.rcon.ports.rcon.port }}" -q 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 "PublicPort" "{{ .Values.service.main.ports.main.port }}" -q
set_ini_value "ServerPassword" "{{ .Values.palworld.game.password }}" -q set_ini_value "ServerPassword" '{{ .Values.palworld.game.password }}' -q
set_ini_value "AdminPassword" "{{ .Values.palworld.game.admin_password }}" -q set_ini_value "AdminPassword" '{{ .Values.palworld.game.admin_password }}' -q
set_ini_value "ServerName" "{{ .Values.palworld.game.name }}" -q set_ini_value "ServerName" '{{ .Values.palworld.game.name }}' -q
set_ini_value "ServerDescription" "{{ .Values.palworld.game.description }}" -q set_ini_value "ServerDescription" '{{ .Values.palworld.game.description }}' -q
set_ini_value "Difficulty" "{{ .Values.palworld.game.difficulty }}" -q set_ini_value "Difficulty" "{{ .Values.palworld.game.difficulty }}" -q
set_ini_value "DeathPenalty" "{{ .Values.palworld.game.death_penalty }}" -q set_ini_value "DeathPenalty" "{{ .Values.palworld.game.death_penalty }}" -q
set_ini_value "Region" "{{ .Values.palworld.game.region }}" -q set_ini_value "Region" "{{ .Values.palworld.game.region }}" -q
@ -221,6 +242,10 @@ workload:
set_ini_value "WorkSpeedRate" "{{ .Values.palworld.game.work_speed_rate }}" set_ini_value "WorkSpeedRate" "{{ .Values.palworld.game.work_speed_rate }}"
set_ini_value "ExpRate" "{{ .Values.palworld.game.exp_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!" echo "Done!"
containers: containers:
main: main:
@ -272,12 +297,6 @@ workload:
enabled: false enabled: false
startup: startup:
enabled: false 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: persistence:
steamcmd: steamcmd:
@ -291,7 +310,16 @@ persistence:
mountPath: /serverdata/serverfiles mountPath: /serverdata/serverfiles
update-config-ini: update-config-ini:
mountPath: /serverdata/serverfiles mountPath: /serverdata/serverfiles
palworld-rcon:
enabled: true
type: configmap
objectName: palworld-rcon
targetSelector:
rcon:
rcon:
mountPath: /rcon.yaml
subPath: rcon.yaml
readOnly: true
portal: portal:
open: open:
enabled: false enabled: false