_palworld.tpl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {{- define "palworld.workload" -}}
  2. workload:
  3. palworld:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.palworldNetwork.hostNetwork }}
  9. securityContext:
  10. fsGroup: {{ .Values.palworldID.group }}
  11. containers:
  12. palworld:
  13. enabled: true
  14. primary: true
  15. imageSelector: image
  16. securityContext:
  17. runAsUser: 0
  18. runAsGroup: 0
  19. runAsNonRoot: false
  20. readOnlyRootFilesystem: false
  21. capabilities:
  22. add:
  23. - CHOWN
  24. - DAC_OVERRIDE
  25. - FOWNER
  26. - SETGID
  27. - SETUID
  28. - SYS_RESOURCE
  29. - KILL
  30. env:
  31. STEAMCMD_DIR: /serverdata/steamcmd
  32. {{- $srvDir := "/serverdata/serverfiles" }}
  33. SERVER_DIR: {{ $srvDir }}
  34. SRV_ADMIN_PWD: {{ .Values.palworldConfig.adminPassword }}
  35. GAME_PARAMS: {{ join " " .Values.palworldConfig.gameParams }}
  36. GAME_PARAMS_EXTRA: {{ join " " .Values.palworldConfig.gameParamsExtra }}
  37. UPDATE_PUBLIC_IP: {{ .Values.palworldConfig.updatePublicIP }}
  38. VALIDATE: {{ .Values.palworldConfig.validate }}
  39. USERNAME: {{ .Values.palworldConfig.username }}
  40. PASSWORD: {{ .Values.palworldConfig.password }}
  41. fixedEnv:
  42. PUID: {{ .Values.palworldID.user }}
  43. {{ with .Values.palworldConfig.additionalEnvs }}
  44. envList:
  45. {{ range $env := . }}
  46. - name: {{ $env.name }}
  47. value: {{ $env.value }}
  48. {{ end }}
  49. {{ end }}
  50. probes:
  51. liveness:
  52. enabled: true
  53. type: tcp
  54. port: {{ .Values.palworldNetwork.rconPort }}
  55. readiness:
  56. enabled: true
  57. type: tcp
  58. port: {{ .Values.palworldNetwork.rconPort }}
  59. startup:
  60. enabled: true
  61. type: tcp
  62. port: {{ .Values.palworldNetwork.rconPort }}
  63. initContainers:
  64. 01-config:
  65. enabled: true
  66. type: init
  67. imageSelector: image
  68. securityContext:
  69. runAsUser: 0
  70. runAsGroup: 0
  71. runAsNonRoot: false
  72. readOnlyRootFilesystem: false
  73. capabilities:
  74. add:
  75. - CHOWN
  76. - DAC_OVERRIDE
  77. - FOWNER
  78. command: /bin/bash
  79. args:
  80. - -c
  81. - |
  82. config={{ $srvDir }}/Pal/Saved/Config/LinuxServer
  83. cfgFile=${config}/PalWorldSettings.ini
  84. mkdir -p ${config}
  85. if [ ! -f ${cfgFile} ]; then
  86. echo "Config file not found, fetching..."
  87. # Fetch the config file if it doesn't exist, just like the container does
  88. wget -qO ${cfgFile} https://github.com/ich777/docker-steamcmd-server/raw/palworld/config/PalWorldSettings.ini
  89. fi
  90. echo "Setting RCON status..."
  91. sed -i 's/\(RCONEnabled=\)[^,]*/\1True/g' ${cfgFile}
  92. echo "Set to [$(grep -Po 'RCONEnabled=[^,]*' ${cfgFile})]"
  93. echo "Setting RCON Port..."
  94. sed -i 's/\(RCONPort=\)[^,]*/\1{{ .Values.palworldNetwork.rconPort }}/g' ${cfgFile}
  95. echo "Set to [$(grep -Po 'RCONPort=[^,]*' ${cfgFile})]"
  96. echo "Setting Game Port..."
  97. sed -i 's/\(PublicPort=\)[^,]*/\1{{ .Values.palworldNetwork.serverPort }}/g' ${cfgFile}
  98. echo "Set to [$(grep -Po 'PublicPort=[^,]*' ${cfgFile})]"
  99. echo "Done!"
  100. {{- end -}}