Skip to content

Commit e109abe

Browse files
author
James Rhoat
authored
Merge pull request #13 from SQLJames/feature/allow-server-id.json
Feature/allow server id.json
2 parents 84b3ec8 + eac41e1 commit e109abe

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ The following table lists the configurable parameters of the `factorio-server-ch
6868
| factorioServer.generate_new_save | Generate a New Save | `true` |
6969
| factorioServer.update_mods_on_start | Update mods on start | `false` |
7070
| factorioServer.load_latest_save | lets the game know if you want to load the latest save | `true` |
71-
| factorioServer.config_path | Location of the configuration files that are generated | `/srv` |
7271
| serverSettings.name | Your Instance Name | `Factorio` |
7372
| serverSettings.description | Your Instance Description | `"Factorio running on Kubernetes"` |
7473
| serverSettings.max_players | Maximum number of players allowed, admins can join even a full server. 0 means unlimited. | `0` |

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: 1.0.9
23+
version: 1.0.10
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/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ The following table lists the configurable parameters of the `factorio-server-ch
6767
| factorioServer.generate_new_save | Generate a New Save | `true` |
6868
| factorioServer.update_mods_on_start | Update mods on start | `false` |
6969
| factorioServer.load_latest_save | lets the game know if you want to load the latest save | `true` |
70-
| factorioServer.config_path | Location of the configuration files that are generated | `/srv` |
7170
| serverSettings.name | Your Instance Name | `Factorio` |
7271
| serverSettings.description | Your Instance Description | `"Factorio running on Kubernetes"` |
7372
| serverSettings.max_players | Maximum number of players allowed, admins can join even a full server. 0 means unlimited. | `0` |

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,34 @@ spec:
1919
labels:
2020
app: {{ template "factorio-server-charts.fullname" . }}
2121
spec:
22-
securityContext:
23-
runAsUser: 845
24-
runAsGroup: 845
25-
fsGroup: 845
22+
initContainers:
23+
- name: volume-permissions-serversettingsconfig
24+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
25+
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
command:
27+
- /bin/bash
28+
- -ec
29+
- |
30+
mkdir -p /factorio/configs
31+
mkdir -p /factorio/config
32+
cp --verbose /deployed-configs/* /factorio/configs
33+
#sleep 100
34+
chown -vR factorio:factorio /factorio
35+
chmod -vR 777 /factorio/configs
36+
ls -alth /factorio
37+
securityContext:
38+
runAsUser: 0
39+
volumeMounts:
40+
- name: datadir
41+
mountPath: /factorio
42+
- name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig
43+
mountPath: /deployed-configs
2644
containers:
2745
- name: {{ template "factorio-server-charts.fullname" . }}
2846
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
2947
imagePullPolicy: {{ .Values.image.pullPolicy }}
3048
securityContext:
3149
runAsUser: 0
32-
allowPrivilegeEscalation: true
3350
ports:
3451
- name: factorio
3552
containerPort: {{ .Values.service.port }}
@@ -41,8 +58,6 @@ spec:
4158
volumeMounts:
4259
- name: datadir
4360
mountPath: /factorio
44-
- name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig
45-
mountPath: {{ .Values.factorioServer.config_path | quote }}
4661
env:
4762
- name: UPDATE_MODS_ON_START
4863
value: {{ .Values.factorioServer.update_mods_on_start | quote }}
@@ -59,7 +74,7 @@ spec:
5974
- name: PORT
6075
value: {{ .Values.service.port | quote }}
6176
- name: CONFIG
62-
value: {{ .Values.factorioServer.config_path | quote }}
77+
value: /factorio/configs
6378
{{- with .Values.nodeSelector }}
6479
nodeSelector:
6580
{{- toYaml . | nindent 8 }}

charts/factorio-server-charts/values.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
#### K8s configuration ####
3-
43
## Number of replicas to create (only 1 is supported)
54
replicaCount: 1
65

@@ -13,18 +12,15 @@ image:
1312
## You should set an fix version, i.e.:
1413
# tag: "1.1.37"
1514

16-
# Security options the operator container should run with
17-
securityContext:
18-
runAsUser: 1000
19-
fsGroup: 2000
15+
2016

2117
## The service is a kind tricky, so factorio uses UDP, but not every cloud provider is able to route UDP traffic.
2218
## I.e. your cloud provider has LoadBalancers without the ability for UPD protocoll. Furthermore kubectl ist not able to route UDP Traffic
2319
## ref: https://github.com/kubernetes/kubernetes/issues/47862
2420
## You have to expose factorio on a NodePort and map a port between 30000 and 32767, but the nativ port ist 34197. So you have always to specify the port in factorio.
2521
## The best way ist to define a ClusterIP service and define one or more externalIPs. Of course this IPs must be avaiable on the node the factorio runs the pod!
2622
service:
27-
type: ClusterIP
23+
type: LoadBalancer
2824
port: 34197
2925
## If you are able in your cluster to map an external IP, set it here
3026
# externalIPs:
@@ -81,7 +77,7 @@ affinity: {}
8177
## Sets the data persistence volume configuration
8278
## IMPORTANT: If you do not setup a PV all your savegames will be lost on pod recreation or helm upgrade
8379
persistence:
84-
enabled: false
80+
enabled: true
8581
dataDir:
8682
Size: "1Gi"
8783
## If you have an existing claim, set your name here
@@ -104,8 +100,7 @@ factorioServer:
104100
update_mods_on_start: false
105101
# lets the game know if you want to load the latest save
106102
load_latest_save: true
107-
# Location of the configuration files that are generated
108-
config_path: /srv
103+
109104

110105
server_settings:
111106
# Your Instance Name

0 commit comments

Comments
 (0)