Skip to content

Commit 9993e23

Browse files
committed
Allow configuring securityContext
1 parent ae4e899 commit 9993e23

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ spec:
5858
chown -vR factorio:factorio /factorio
5959
chmod -vR 777 /factorio/configs
6060
ls -alth /factorio
61+
{{- with .Values.securityContext }}
6162
securityContext:
62-
runAsUser: 0
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
6365
volumeMounts:
6466
- name: datadir
6567
mountPath: /factorio
@@ -87,8 +89,10 @@ spec:
8789
- |
8890
mkdir -p /factorio/mods
8991
bash /scripts/mod-downloader.sh
92+
{{- with .Values.securityContext }}
9093
securityContext:
91-
runAsUser: 0
94+
{{- toYaml . | nindent 12 }}
95+
{{- end }}
9296
volumeMounts:
9397
- name: datadir
9498
mountPath: /factorio
@@ -103,8 +107,10 @@ spec:
103107
- name: {{ template "factorio-server-charts.fullname" . }}
104108
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
105109
imagePullPolicy: {{ .Values.image.pullPolicy }}
110+
{{- with .Values.securityContext }}
106111
securityContext:
107-
runAsUser: 0
112+
{{- toYaml . | nindent 10 }}
113+
{{- end }}
108114
livenessProbe:
109115
exec:
110116
command:

charts/factorio-server-charts/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
## @param strategy.type Strategy used to replace old pods
99
## @param tolerations Tolerations for pod assignment
1010
## @param affinity Affinity rules for pod assignment
11-
11+
## @param securityContext Useful for fixing file permissions. See official [docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/).
1212

1313
replicaCount: 1
1414

15+
securityContext:
16+
runAsUser: 0
1517

1618
#### Image Configuration ####
1719
## @section Image Parameters

0 commit comments

Comments
 (0)