Skip to content

Commit

Permalink
Update mornedhels/enshrouded-server to v1.2.0
Browse files Browse the repository at this point in the history
- Remove gamePort, as Enshrouded only uses queryPort now
- Add support for setting hooks in values file
- Add experimental role support
- Update readme to reflect new password options
  • Loading branch information
bdelwood committed Jul 13, 2024
1 parent 27a2d62 commit 4186f10
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 38 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ helm install enshrouded-server enshrouded-k8s/enshrouded-k8s \
--set gameServer.password=changeme
```

As Enshrouded seems to rely on the query port being enabled to find and connect to servers, the server is configured with the query port exposed by default.

The chart will generate a server password, which can be retrieved with

```bash
Expand All @@ -26,6 +24,9 @@ kubectl get secrets <secrets-name> -o json | jq '.data | map_values(@base64d)'

Alternatively, the password can be supplied in the `values` file or by specifying existing secrets. The secret must have a `server-password` key.

> [!TIP]
> Passwords for roles can be provided in the same secret as `<role-name>-password`.
By default, the chart will provision a PVC using the default StorageClass. You can also provide an existing PVC, or change the StorageClass.

# Configuration
Expand Down
4 changes: 2 additions & 2 deletions chart/enshrouded-k8s/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apiVersion: v2
description: A basic chart to deploy Enshrouded dedicated servers.
name: enshrouded-k8s
type: application
version: 0.4.0
appVersion: "1.1.0"
version: 0.5.0
appVersion: "1.2.0"
kubeVersion: ">=1.26.0-0"
sources:
- https://github.com/bdelwood/enshrouded-k8s
Expand Down
13 changes: 8 additions & 5 deletions chart/enshrouded-k8s/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# enshrouded-k8s

![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.1.0](https://img.shields.io/badge/AppVersion-1.1.0-informational?style=flat-square)
![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.0](https://img.shields.io/badge/AppVersion-1.2.0-informational?style=flat-square)

A basic chart to deploy Enshrouded dedicated servers.

Expand All @@ -22,22 +22,25 @@ Kubernetes: `>=1.26.0-0`
| gameServer.backup.cron_expression | string | `"*/15 * * * *"` | Cron expression for backup scheduling. Defines when the backups should be triggered. The default value schedules a backup every 15 minutes. Use standard cron format. |
| gameServer.backup.directory | string | `"./backup"` | Directory for backups. Supports relative and absolute paths. |
| gameServer.backup.max_count | int | `0` | Number of backups to keep. When set to 0, never delete backups |
| gameServer.community.enabled | bool | `true` | Enable if you want your server to show up as a community server. Exposes the Steam query port. |
| gameServer.community.service.nodePort | int | `nil` | Node port a community server (for NodePort service type). Defaults to Node port for game server + 1 |
| gameServer.community.service.port | int | `nil` | Service port for a community server. Defaults to the server port + 1 |
| gameServer.existingSecret | string | `""` | Name of an existing secret for the server password. |
| gameServer.gameBranch | string | `"public"` | Which Steam branch to use for the game server. |
| gameServer.logDir | string | `"./logs"` | Directory for logs sets logDirectory in game server config |
| gameServer.password | string | `""` | Server password If one is not provided or an existing secret it not provided, one will be generated. |
| gameServer.players | int | `16` | Number of players allowed on the server concurrently. |
| gameServer.roles | list | `[]` | A list of roles for the game server. Each role includes a name, an optional password, a list of permissions, and the number of reserved slots. If the password is empty or missing, one will be generated. The role passwords can be provided with an existing secret via `existingSecret`, where the key must have the format `<role-name>-password`. See the [official docs](https://enshrouded.zendesk.com/hc/en-us/articles/19191581489309-Server-Roles-Configuration) for more details on roles. |
| gameServer.saveDir | string | `"./savegame"` | Directory for game saves sets saveDirectory in game server config |
| gameServer.serverIP | string | `"0.0.0.0"` | Server IP used Enshrouded server settings |
| gameServer.serverName | string | `""` | Custom server name. |
| gameServer.service.nodePort | int | `nil` | Node port for the game server (for NodePort service type). |
| gameServer.service.port | int | `15636` | Service port for the game server. |
| gameServer.service.port | int | `15637` | Service port for the game server. |
| gameServer.steamcmdArgs | string | `"validate"` | Extra arguments to pass to steamcmd when updating. |
| gameServer.update.check_players | bool | `false` | Check if players are connected before updating. |
| gameServer.update.cron_expression | string | `"*/30 * * * *"` | Cron expression for updates. Defines when the update check should run. The default value checks for updates every half hour. Use standard cron format. |
| hooks.backup.post | string | `""` | Command to run after backup & cleanup |
| hooks.backup.pre | string | `""` | Command to run before backup & cleanup |
| hooks.bootstrap | string | `""` | Command to run after general bootstrap |
| hooks.update.post | string | `""` | Command to run after update |
| hooks.update.pre | string | `""` | Command to run before update |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.registry | string | `"docker.io"` | Container registry for the image. |
| image.repository | string | `"mornedhels/enshrouded-server"` | Image repository |
Expand Down
12 changes: 12 additions & 0 deletions chart/enshrouded-k8s/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ data:
BACKUP_MAX_COUNT: "{{ .Values.gameServer.backup.max_count }}"
GAME_BRANCH: "{{ .Values.gameServer.gameBranch }}"
STEAMCMD_ARGS: "{{ .Values.gameServer.steamcmdArgs }}"
{{- range $index, $role := .Values.gameServer.roles }}
SERVER_ROLE_{{ $index }}_NAME: "{{ $role.name }}"
SERVER_ROLE_{{ $index }}_RESERVED_SLOTS: "{{ $role.reserved_slots }}"
{{- range $permission := $role.permissions }}
SERVER_ROLE_{{ $index }}_CAN_{{ upper $permission }}: true
{{- end }}
{{- end }}
BOOTSTRAP_HOOK: "{{ .Values.hooks.bootstrap }}"
UPDATE_PRE_HOOK: "{{ .Values.hooks.update.pre }}"
UPDATE_POST_HOOK: "{{ .Values.hooks.update.post }}"
BACKUP_PRE_HOOK: "{{ .Values.hooks.backup.pre }}"
BACKUP_POST_HOOK: "{{ .Values.hooks.backup.post }}"
{{- range $key, $value := .Values.extraEnv }}
{{ $key }}: "{{ $value }}"
{{- end }}
10 changes: 7 additions & 3 deletions chart/enshrouded-k8s/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ spec:
secretKeyRef:
name: {{ default (include "enshrouded-k8s.fullname" .) .Values.gameServer.existingSecret | quote }}
key: server-password
{{- range $index, $role := $.Values.gameServer.roles }}
- name: SERVER_ROLE_{{ $index }}_PASSWORD
valueFrom:
secretKeyRef:
name: {{ default (include "enshrouded-k8s.fullname" $) $.Values.gameServer.existingSecret | quote }}
key: {{ $role.name }}-password
{{- end }}
ports:
- name: gameserver
containerPort: 15636
protocol: UDP
- name: queryport
containerPort: 15637
protocol: UDP
Expand Down
3 changes: 3 additions & 0 deletions chart/enshrouded-k8s/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ metadata:
type: Opaque
data:
server-password: {{ default (randAlphaNum 12) .Values.gameServer.password | b64enc | quote }}
{{- range $index, $role := .Values.gameServer.roles }}
{{ $role.name }}-password: {{ default (randAlphaNum 12) $role.password | b64enc | quote }}
{{- end }}
{{- end }}
14 changes: 2 additions & 12 deletions chart/enshrouded-k8s/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,12 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
- name: gameserver
port: {{ .Values.gameServer.service.port | int }}
protocol: UDP
targetPort: gameserver
{{- if eq .Values.service.type "NodePort" }}
nodePort: {{ default "" .Values.gameServer.service.nodePort | int }}
{{- end }}
{{- if .Values.gameServer.community.enabled }}
- name: queryport
port: {{ default (add .Values.gameServer.service.port 1) .Values.gameServer.community.service.port | int }}
port: {{ .Values.gameServer.service.port | int }}
protocol: UDP
targetPort: queryport
{{- if eq .Values.service.type "NodePort" }}
{{- $defaultNodePort := add (.Values.gameServer.service.nodePort | int) 1 }}
nodePort: {{ default $defaultNodePort .Values.gameServer.community.service.nodePort | int }}
nodePort: {{ default "" .Values.gameServer.service.nodePort | int }}
{{- end }}
{{- end }}
selector:
{{- include "enshrouded-k8s.selectorLabels" . | nindent 4 }}
44 changes: 30 additions & 14 deletions chart/enshrouded-k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,9 @@ gameServer:
password: ""
service:
# -- Service port for the game server.
port: 15636
port: 15637
# -- (int) Node port for the game server (for NodePort service type).
nodePort:
community:
# -- Enable if you want your server to show up as a community server.
# Exposes the Steam query port.
enabled: true
service:
# -- (int) Service port for a community server.
# Defaults to the server port + 1
port:
# -- (int) Node port a community server (for NodePort service type).
# Defaults to Node port for game server + 1
nodePort:
# -- Server IP used Enshrouded server settings
serverIP: "0.0.0.0"

Expand Down Expand Up @@ -87,8 +76,35 @@ gameServer:
gameBranch: "public"
# -- Extra arguments to pass to steamcmd when updating.
steamcmdArgs: "validate"


# -- A list of roles for the game server.
# Each role includes a name, an optional password, a list of permissions, and the number of reserved slots. If the password is empty or missing, one will be generated. The role passwords can be provided with an existing secret via `existingSecret`, where the key must have the format `<role-name>-password`.
# See the [official docs](https://enshrouded.zendesk.com/hc/en-us/articles/19191581489309-Server-Roles-Configuration) for more details on roles.
roles: []
# - name: "default" # The name of the role.
# password: "" # (Optional) The password for the role.
# permissions: # A list of permissions granted to this role.
# - "kick_ban" # Allows the role to kick and ban players.
# - "access_inventories" # Allows the role to access player inventories.
# - "edit_base" # Allows the role to edit the base.
# - "extend_base" # Allows the role to extend the base.
# reserved_slots: 16 # The number of slots reserved for this role.
# - name: "guests" # A role with no permissions
# reserved_slots: 1


hooks:
# -- Command to run after general bootstrap
bootstrap: ""
update:
# -- Command to run before update
pre: ""
# -- Command to run after update
post: ""
backup:
# -- Command to run before backup & cleanup
pre: ""
# -- Command to run after backup & cleanup
post: ""

# -- Define extra environment variables to pass directly to the container.
# Any env vars which are set by other values will be overridden.
Expand Down

0 comments on commit 4186f10

Please sign in to comment.