Files
helm-charts/satisfactory/templates/satisfactory.sfs.yaml
T
jklein 247c01bce1 satisfactory chart: naming scheme, security hardening, configurable probes
All audit findings from #32 for the satisfactory chart in one major PR:

- StatefulSet renamed to {{ .Release.Name }}-{{ .Chart.Name }}-sfs, service
  to ...-service (standard scheme); template file satisfactory-server.sfs.yaml
  renamed to satisfactory.sfs.yaml. The PVC keeps its historical -vc name
  (documented naming exception; renaming would orphan the data).
- Hardened, values-configurable security contexts (securityContext.pod /
  securityContext.container): runAsNonRoot with the image's steam user
  (uid/gid 1000), readOnlyRootFilesystem, all capabilities dropped. emptyDirs
  mounted at /tmp and the steam user's ~/.steam, ~/.config and ~/.local make
  the read-only root filesystem work; all other writes go to the PVC.
- Probes are now values (livenessProbe/readinessProbe/startupProbe), defaults
  exactly the previously hardcoded values.
- Additive env value rendered through tpl with value/secretKeyRef/
  configMapKeyRef forms (template-chart pattern).

Chart 3.1.1+upv1.9.10 -> 4.0.0+upv1.9.10 (major: resource renames +
hardening); appVersion unchanged.
2026-08-22 16:00:33 +02:00

118 lines
4.6 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service
replicas: {{ include "satisfactory.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.server.replicas) }}
template:
metadata:
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
spec:
automountServiceAccountToken: false
securityContext:
{{- toYaml .Values.securityContext.pod | nindent 8 }}
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
image: "ghcr.io/wolveix/satisfactory-server:{{ .Chart.AppVersion }}"
env:
- name: DEBUG
value: "{{ .Values.dev.debug }}"
- name: MAXPLAYERS
value: "{{ .Values.game.maxPlayers }}"
# PUID/PGID are only used by the image's root entrypoint path;
# with the default non-root security context they are ignored.
- name: PGID
value: "1000"
- name: PUID
value: "1000"
- name: SKIPUPDATE
value: "false"
- name: STEAMBETA
value: "{{ .Values.game.experimental }}"
- name: DISABLESEASONALEVENTS
value: "{{ .Values.game.seasonalEvents }}"
- name: SERVERGAMEPORT
value: "{{ .Values.server.gamePort }}"
- name: SERVERMESSAGINGPORT
value: "{{ .Values.server.messagingPort }}"
{{- range $value := .Values.env }}
{{- if $value.value }}
- name: {{ $value.name }}
value: {{ tpl $value.value $ }}
{{- else if $value.valueFrom }}
{{- if $value.valueFrom.secretKeyRef }}
- name: {{ $value.name }}
valueFrom:
secretKeyRef:
name: {{ tpl $value.valueFrom.secretKeyRef.name $ }}
key: {{ tpl $value.valueFrom.secretKeyRef.key $ }}
{{- else if $value.valueFrom.configMapKeyRef }}
- name: {{ $value.name }}
valueFrom:
configMapKeyRef:
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ }}
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ }}
{{- end }}
{{- end }}
{{- end }}
ports:
- name: "api"
containerPort: {{ .Values.server.gamePort }}
protocol: TCP
- name: "game"
containerPort: {{ .Values.server.gamePort }}
protocol: UDP
- name: "messaging"
containerPort: {{ .Values.server.messagingPort }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
startupProbe:
{{- toYaml .Values.startupProbe | nindent 12 }}
resources:
{{- include "satisfactory.resources" .Values.server.resources | nindent 12 }}
volumeMounts:
- name: satisfactory-volume
mountPath: /config
subPath: config/
- name: satisfactory-volume
mountPath: /config/gamefiles
subPath: gameFiles/
# Writable paths required by readOnlyRootFilesystem: the steam
# user's home dot-dirs (steamcmd bootstraps itself into
# ~/.local/share/Steam, keeps state under ~/.steam, and the game
# saves symlink lives under ~/.config) and /tmp (crash dumps).
# Everything else is written to the PVC at /config.
- name: steam-home
mountPath: /home/steam/.steam
subPath: dot-steam
- name: steam-home
mountPath: /home/steam/.config
subPath: dot-config
- name: steam-home
mountPath: /home/steam/.local
subPath: dot-local
- name: tmp
mountPath: /tmp
securityContext:
{{- toYaml .Values.securityContext.container | nindent 12 }}
volumes:
- name: satisfactory-volume
persistentVolumeClaim:
# Deliberate exception from the naming scheme: renaming the PVC
# would detach existing data (see README, naming exceptions).
claimName: {{ .Release.Name }}-{{ .Chart.Name }}-vc
- name: steam-home
emptyDir: {}
- name: tmp
emptyDir: {}