Skip to content

Commit 78cf1bd

Browse files
authored
Merge pull request #69 from SQLJames/bug/nfsPermissions
updating security context
2 parents f3a6387 + 36f8099 commit 78cf1bd

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Changelog
22

3+
### V2.4.0
4+
5+
#### Potentially Breaking Changes
6+
7+
- Removing the chown of the data directory initialization and instead switching the security context to use the factorio user specified in [factorio docker](https://github.com/factoriotools/factorio-docker/blob/master/docker/Dockerfile). This will fix the nfs permissions but could potentially cause issues elsewhere if you were setting the security context.
8+
39
### V2.3.0
410

511
#### Non-Breaking Changes

charts/factorio-server-charts/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sources:
2020
# This is the chart version. This version number should be incremented each time you make changes
2121
# to the chart and its templates, including the app version.
2222
# Versions are expected to follow Semantic Versioning (https://semver.org/)
23-
version: 2.3.0
23+
version: 2.4.0
2424

2525
# This is the version number of the application being deployed. This version number should be
2626
# incremented each time you make changes to the application. Versions are not expected to

charts/factorio-server-charts/templates/deployment.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ spec:
1919
labels:
2020
app: {{ template "factorio-server-charts.fullname" . }}
2121
spec:
22+
{{- with .Values.securityContext }}
23+
securityContext:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
2226
dnsConfig:
2327
options:
2428
- name: ndots
@@ -53,10 +57,9 @@ spec:
5357
jq -M --rawfile game_password /gamePassword/game_password '.game_password=($game_password|gsub("[\\n\\t]"; ""))' /factorio/configs/server-settings.json > /tmp/server-settings.json && mv /tmp/server-settings.json /factorio/configs/server-settings.json
5458
fi
5559
#sleep 100
56-
chown -vR factorio:factorio /factorio
5760
chmod -vR 777 /factorio/configs
5861
ls -alth /factorio
59-
{{- with .Values.securityContext }}
62+
{{- with .Values.podSecurityContext }}
6063
securityContext:
6164
{{- toYaml . | nindent 12 }}
6265
{{- end }}
@@ -87,7 +90,7 @@ spec:
8790
- |
8891
mkdir -p /factorio/mods
8992
bash /scripts/mod-downloader.sh
90-
{{- with .Values.securityContext }}
93+
{{- with .Values.podSecurityContext }}
9194
securityContext:
9295
{{- toYaml . | nindent 12 }}
9396
{{- end }}
@@ -110,7 +113,7 @@ spec:
110113
- -ec
111114
- |
112115
bash /scripts/save-importer.sh
113-
{{- with .Values.securityContext }}
116+
{{- with .Values.podSecurityContext }}
114117
securityContext:
115118
{{- toYaml . | nindent 12 }}
116119
{{- end }}
@@ -124,7 +127,7 @@ spec:
124127
- name: {{ template "factorio-server-charts.fullname" . }}
125128
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
126129
imagePullPolicy: {{ .Values.image.pullPolicy }}
127-
{{- with .Values.securityContext }}
130+
{{- with .Values.podSecurityContext }}
128131
securityContext:
129132
{{- toYaml . | nindent 10 }}
130133
{{- end }}
@@ -210,7 +213,7 @@ spec:
210213
- name: {{ template "factorio-server-charts.fullname" . }}-port-fixer
211214
image: "{{ .Values.port_fixer.image.repository }}:{{ .Values.port_fixer.image.tag }}"
212215
imagePullPolicy: {{ .Values.port_fixer.image.pullPolicy }}
213-
{{- with .Values.securityContext }}
216+
{{- with .Values.podSecurityContext }}
214217
securityContext:
215218
{{- toYaml . | nindent 10 }}
216219
{{- end }}

charts/factorio-server-charts/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ replicaCount: 1
1414

1515
hostNetworkEnabled: true
1616

17+
# https://github.com/factoriotools/factorio-docker/blob/master/docker/Dockerfile
1718
securityContext:
18-
runAsUser: 0
19+
fsGroup: 845
20+
21+
podSecurityContext:
22+
runAsUser: 845
23+
runAsGroup: 845
1924

2025
#### Image Configuration ####
2126
## @section Image Parameters

0 commit comments

Comments
 (0)