palworld-server-docker icon indicating copy to clipboard operation
palworld-server-docker copied to clipboard

palworld-settings configmap did not work in k8s

Open FluffyLumi opened this issue 1 year ago • 5 comments

Describe the bug

palworld-settings did not work in k8s. Here is my yaml file

---
apiVersion: v1
kind: Namespace
metadata:
  name: palworld

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: palworld-cm
  namespace: palworld
data:
  PUID: "1000"
  PGID: "1000"
  PORT: "8211"
  PLAYERS: "16"
  SERVER_PASSWORD: "xxxxxxxx"
  MULTITHREADING: "true"
  RCON_ENABLED: "true"
  RCON_PORT: "25575"
  TZ: CST
  COMMUNITY: "false"
  SERVER_NAME: "xxxxxxxx"
  SERVER_DESCRIPTION: ""
---
apiVersion: v1
kind: Secret
metadata:
  name: palworld-secrets
  namespace: palworld
type: Opaque
stringData:
  rconPassword: xxxxxxxx
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: palworld-settings
  namespace: palworld
data:
  PalWorldSettings.ini: |-
    [/Script/Pal.PalGameWorldSettings]

    OptionSettings=(
    Difficulty=None,
    DayTimeSpeedRate=2.000000,
    NightTimeSpeedRate=0.5000000,
    ExpRate=2.5000000,
    PalCaptureRate=2.5000000,
    PalSpawnNumRate=1.000000,
    PalDamageRateAttack=1.000000,
    PalDamageRateDefense=1.000000,
    PlayerDamageRateAttack=1.000000,
    PlayerDamageRateDefense=1.000000,
    PlayerStomachDecreaceRate=1.000000,
    PlayerStaminaDecreaceRate=1.000000,
    PlayerAutoHPRegeneRate=1.000000,
    PlayerAutoHpRegeneRateInSleep=1.000000,
    PalStomachDecreaceRate=1.000000,
    PalStaminaDecreaceRate=1.000000,
    PalAutoHPRegeneRate=1.000000,
    PalAutoHpRegeneRateInSleep=1.000000,
    BuildObjectDamageRate=1.000000,
    BuildObjectDeteriorationDamageRate=1.000000,
    CollectionDropRate=3.000000,
    CollectionObjectHpRate=1.000000,
    CollectionObjectRespawnSpeedRate=1.000000,
    EnemyDropItemRate=1.000000,
    DeathPenalty=None,
    bEnablePlayerToPlayerDamage=False,
    bEnableFriendlyFire=False,
    bEnableInvaderEnemy=True,
    bActiveUNKO=False,
    bEnableAimAssistPad=True,
    bEnableAimAssistKeyboard=False,
    DropItemMaxNum=3000,
    DropItemMaxNum_UNKO=100,
    BaseCampMaxNum=128,
    BaseCampWorkerMaxNum=15,
    DropItemAliveMaxHours=1.000000,
    bAutoResetGuildNoOnlinePlayers=False,
    AutoResetGuildTimeNoOnlinePlayers=72.000000,
    GuildPlayerMaxNum=20,
    PalEggDefaultHatchingTime=0.000000,
    WorkSpeedRate=1.000000,
    bIsMultiplay=False,
    bIsPvP=False,
    bCanPickupOtherGuildDeathPenaltyDrop=False,
    bEnableNonLoginPenalty=True,
    bEnableFastTravel=True,
    bIsStartLocationSelectByMap=True,
    bExistPlayerAfterLogout=False,
    bEnableDefenseOtherGuildPlayer=False,
    CoopPlayerMaxNum=4,
    ServerPlayerMaxNum=32,
    ServerName=" xxxxxxxx",
    ServerDescription="xxxxxxxx",
    AdminPassword="xxxxxxxx",
    ServerPassword="",
    PublicPort=8211,
    PublicIP="",
    RCONEnabled=true,
    RCONPort=25575,
    Region="",
    bUseAuth=True,
    BanListURL="https://api.palworldgame.com/api/banlist.txt"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: palworld-server
  namespace: palworld
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: palworld-server
  template:
    metadata:
      labels:
        app: palworld-server
    spec:
      containers:
      - name: palworld-server
        image: registry.cn-hangzhou.aliyuncs.com/jihaoyun/palworld-server-docker:latest
        resources:
          limits:
            cpu: "4"
            memory: "15Gi"
          requests:
            cpu: "4"
            memory: "15Gi"
        env:
        - name: ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              name: palworld-secrets
              key: rconPassword
        envFrom:
        - configMapRef:
            name: palworld-cm
        ports:
        - containerPort: 8211
          name: server
          protocol: UDP
        - containerPort: 27015
          name: query
          protocol: UDP
        volumeMounts:
        - mountPath: /palworld
          name: datadir
        - name: palworld-settings
          mountPath: /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
          subPath: PalWorldSettings.ini
      tolerations:
      - key: "CriticalAddonsOnly"
        operator: "Equal"
        value: "home"
        effect: "NoSchedule"
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - worker-haoyun-home
      volumes:
      - name: datadir
        hostPath:
          path: /nfs-ssd/palworld
          type: Directory
      - name: palworld-settings
        configMap:
          name: palworld-settings
          defaultMode: 0666
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: palworld-server
  name: palworld-server
  namespace: palworld
spec:
  ports:
  - name: server
    port: 8211
    protocol: UDP
    targetPort: server
    nodePort: 8211
  - name: query
    port: 27015
    protocol: UDP
    targetPort: query
    nodePort: 27015
  selector:
    app: palworld-server
  type: NodePort

FluffyLumi avatar Jan 29 '24 16:01 FluffyLumi

Can you update the issue with the error message?

Filipe-Souza avatar Jan 29 '24 16:01 Filipe-Souza

Can you update the issue with the error message?

I haven't found any error in the log of pod, but I noticed that pal-settings configmap has been deleted in commit 7de5997.

FluffyLumi avatar Jan 29 '24 16:01 FluffyLumi

Check the file on the pod itself, how is it formatted?

It should look like this

[/Script/Pal.PalGameWorldSettings]
OptionSettings=( Difficulty=Normal, DayTimeSpeedRate=1.000000, NightTimeSpeedRate=1.000000, ExpRate=1.250000, PalCaptureRate=1.000000, PalSpawnNumRate=1.000000, PalDamageRateAttack=1.000000,...

These will not work:

[/Script/Pal.PalGameWorldSettings] OptionSettings=( Difficulty=Normal, DayTimeSpeedRate=1.000000, NightTimeSpeedRate=1.000000, ExpRate=1.250000, PalCaptureRate=1.000000, PalSpawnNumRate=1.000000, PalDamageRateAttack=1.000000,...
[/Script/Pal.PalGameWorldSettings]
OptionSettings=( 
Difficulty=Normal, 
DayTimeSpeedRate=1.000000, 
NightTimeSpeedRate=1.000000, 
ExpRate=1.250000, 
PalCaptureRate=1.000000, 
PalSpawnNumRate=1.000000, 
PalDamageRateAttack=1.000000,
....

MSpreckels avatar Jan 29 '24 16:01 MSpreckels

Check the file on the pod itself, how is it formatted?

It should look like this

[/Script/Pal.PalGameWorldSettings]
OptionSettings=( Difficulty=Normal, DayTimeSpeedRate=1.000000, NightTimeSpeedRate=1.000000, ExpRate=1.250000, PalCaptureRate=1.000000, PalSpawnNumRate=1.000000, PalDamageRateAttack=1.000000,...

These will not work:

[/Script/Pal.PalGameWorldSettings] OptionSettings=( Difficulty=Normal, DayTimeSpeedRate=1.000000, NightTimeSpeedRate=1.000000, ExpRate=1.250000, PalCaptureRate=1.000000, PalSpawnNumRate=1.000000, PalDamageRateAttack=1.000000,...
[/Script/Pal.PalGameWorldSettings]
OptionSettings=( 
Difficulty=Normal, 
DayTimeSpeedRate=1.000000, 
NightTimeSpeedRate=1.000000, 
ExpRate=1.250000, 
PalCaptureRate=1.000000, 
PalSpawnNumRate=1.000000, 
PalDamageRateAttack=1.000000,
....

The configmap in my yaml file was created according to https://github.com/thijsvanloef/palworld-server-docker/blob/c676c1c1c13ca66f2d1b8337b4508e12b2be4272/k8s/configmap.yaml#L24. As a result, it looks like below in the pod:

[/Script/Pal.PalGameWorldSettings]

OptionSettings=(
Difficulty=None,
DayTimeSpeedRate=2.000000,
NightTimeSpeedRate=0.5000000,
ExpRate=2.5000000,
PalCaptureRate=2.5000000,
PalSpawnNumRate=1.000000,
PalDamageRateAttack=1.000000,
PalDamageRateDefense=1.000000,
PlayerDamageRateAttack=1.000000,
PlayerDamageRateDefense=1.000000,
PlayerStomachDecreaceRate=1.000000,
PlayerStaminaDecreaceRate=1.000000,
PlayerAutoHPRegeneRate=1.000000,
PlayerAutoHpRegeneRateInSleep=1.000000,
PalStomachDecreaceRate=1.000000,
PalStaminaDecreaceRate=1.000000,
PalAutoHPRegeneRate=1.000000,
PalAutoHpRegeneRateInSleep=1.000000,
BuildObjectDamageRate=1.000000,
BuildObjectDeteriorationDamageRate=1.000000,
CollectionDropRate=3.000000,
CollectionObjectHpRate=1.000000,
CollectionObjectRespawnSpeedRate=1.000000,
EnemyDropItemRate=1.000000,
DeathPenalty=None,
bEnablePlayerToPlayerDamage=False,
bEnableFriendlyFire=False,
bEnableInvaderEnemy=True,
bActiveUNKO=False,
bEnableAimAssistPad=True,
bEnableAimAssistKeyboard=False,
DropItemMaxNum=3000,
DropItemMaxNum_UNKO=100,
BaseCampMaxNum=128,
BaseCampWorkerMaxNum=15,
DropItemAliveMaxHours=1.000000,
bAutoResetGuildNoOnlinePlayers=False,
AutoResetGuildTimeNoOnlinePlayers=72.000000,
GuildPlayerMaxNum=20,
PalEggDefaultHatchingTime=0.000000,
WorkSpeedRate=1.000000,
bIsMultiplay=False,
bIsPvP=False,
bCanPickupOtherGuildDeathPenaltyDrop=False,
bEnableNonLoginPenalty=True,
bEnableFastTravel=True,
bIsStartLocationSelectByMap=True,
bExistPlayerAfterLogout=False,
bEnableDefenseOtherGuildPlayer=False,
CoopPlayerMaxNum=4,
ServerPlayerMaxNum=32,
ServerName=" xxxxxxxx",
ServerDescription="xxxxxxxx",
AdminPassword="xxxxxxxx",
ServerPassword="",
PublicPort=8211,
PublicIP="",
RCONEnabled=true,
RCONPort=25575,
Region="",
bUseAuth=True,
BanListURL="https://api.palworldgame.com/api/banlist.txt"

The path of this file in the pod is /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini

FluffyLumi avatar Jan 29 '24 16:01 FluffyLumi

Yeah that does not work.

There is a big difference between PalWorldSettings.ini: >- and PalWorldSettings.ini: |-

where |- keeps the new lines, which is bad and >- replaces them as spaces. Check https://yaml-multiline.info for more

MSpreckels avatar Jan 29 '24 18:01 MSpreckels

Is this issue still relevant?

thijsvanloef avatar Feb 28 '24 07:02 thijsvanloef

Is this issue still relevant?

The problem has been solved, thanks a lot.

FluffyLumi avatar Feb 28 '24 08:02 FluffyLumi