_palworld.tpl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. # This var does not seem to be used from the container script
  35. # But is documented in the README, we currently update the password
  36. # with the initContainer, keeping this here to avoid inconsistencies
  37. # in case the container script is updated
  38. SRV_ADMIN_PWD: {{ .Values.palworldConfig.adminPassword }}
  39. GAME_PARAMS: {{ join " " .Values.palworldConfig.gameParams }}
  40. GAME_PARAMS_EXTRA: {{ join " " .Values.palworldConfig.gameParamsExtra }}
  41. UPDATE_PUBLIC_IP: {{ .Values.palworldConfig.updatePublicIP }}
  42. VALIDATE: {{ .Values.palworldConfig.validate }}
  43. USERNAME: {{ .Values.palworldConfig.username }}
  44. PASSWORD: {{ .Values.palworldConfig.password }}
  45. BACKUP: {{ .Values.palworldConfig.backup.enabled | default false }}
  46. BACKUP_INTERVAL: {{ .Values.palworldConfig.backup.interval | default 120 }}
  47. BACKUPS_TO_KEEP: {{ .Values.palworldConfig.backup.keep | default 3 }}
  48. fixedEnv:
  49. PUID: {{ .Values.palworldID.user }}
  50. {{ with .Values.palworldConfig.additionalEnvs }}
  51. envList:
  52. {{ range $env := . }}
  53. - name: {{ $env.name }}
  54. value: {{ $env.value }}
  55. {{ end }}
  56. {{ end }}
  57. probes:
  58. liveness:
  59. enabled: true
  60. type: tcp
  61. port: {{ .Values.palworldNetwork.rconPort }}
  62. readiness:
  63. enabled: true
  64. type: tcp
  65. port: {{ .Values.palworldNetwork.rconPort }}
  66. startup:
  67. enabled: true
  68. type: tcp
  69. port: {{ .Values.palworldNetwork.rconPort }}
  70. initContainers:
  71. 01-config:
  72. enabled: true
  73. type: init
  74. imageSelector: image
  75. securityContext:
  76. runAsUser: 0
  77. runAsGroup: 0
  78. runAsNonRoot: false
  79. readOnlyRootFilesystem: false
  80. capabilities:
  81. add:
  82. - CHOWN
  83. - DAC_OVERRIDE
  84. - FOWNER
  85. command: /bin/bash
  86. args:
  87. - -c
  88. - |
  89. config={{ $srvDir }}/Pal/Saved/Config/LinuxServer
  90. cfgFile=${config}/PalWorldSettings.ini
  91. mkdir -p ${config}
  92. if [ ! -f ${cfgFile} ]; then
  93. echo "Config file not found, fetching..."
  94. # Fetch the config file if it doesn't exist, just like the container does
  95. wget -qO ${cfgFile} https://github.com/ich777/docker-steamcmd-server/raw/palworld/config/PalWorldSettings.ini
  96. fi
  97. echo "Setting RCON status..."
  98. sed -i 's/\(RCONEnabled=\)[^,]*/\1True/g' ${cfgFile}
  99. echo "Set to [$(grep -Po 'RCONEnabled=[^,]*' ${cfgFile})]"
  100. echo "Setting RCON Port..."
  101. sed -i 's/\(RCONPort=\)[^,]*/\1{{ .Values.palworldNetwork.rconPort }}/g' ${cfgFile}
  102. echo "Set to [$(grep -Po 'RCONPort=[^,]*' ${cfgFile})]"
  103. echo "Setting Game Port..."
  104. sed -i 's/\(PublicPort=\)[^,]*/\1{{ .Values.palworldNetwork.serverPort }}/g' ${cfgFile}
  105. echo "Set to [$(grep -Po 'PublicPort=[^,]*' ${cfgFile})]"
  106. echo "Setting Server Name..."
  107. sed -i 's/\(ServerName=\)[^,]*/\1{{ .Values.palworldConfig.server.name | quote }}/g' ${cfgFile}
  108. echo "Set to [$(grep -Po 'ServerName=[^,]*' ${cfgFile})]"
  109. echo "Setting Server Description..."
  110. sed -i 's/\(ServerDescription=\)[^,]*/\1{{ .Values.palworldConfig.server.description | quote }}/g' ${cfgFile}
  111. echo "Set to [$(grep -Po 'ServerDescription=[^,]*' ${cfgFile})]"
  112. echo "Setting Server Password..."
  113. sed -i 's/\(ServerPassword=\)[^,]*/\1{{ .Values.palworldConfig.server.password | quote }}/g' ${cfgFile}
  114. echo "Server Password set..."
  115. echo "Setting Admin Password..."
  116. sed -i 's/\(AdminPassword=\)[^,]*/\1{{ .Values.palworldConfig.adminPassword | quote }}/g' ${cfgFile}
  117. echo "Admin Password set..."
  118. echo "Done!"
  119. {{- end -}}