Skip to content

Commit 77fd480

Browse files
authored
Merge branch 'main' into factorio-rcon-api
2 parents deaac1f + 8aea01d commit 77fd480

File tree

8 files changed

+101
-12
lines changed

8 files changed

+101
-12
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
## Changelog
22

3-
### V2.0.3
3+
### V2.1.1
44

55
#### Non-Breaking Changes
66

77
- Added support for [nekomeowww/factorio-rcon-api](https://github.com/nekomeowww/factorio-rcon-api) including corresponding fields for values.yaml
88

9+
### V2.1.0
10+
11+
#### Non-Breaking Changes
12+
13+
- Added support for [ZCube/factorio-port-fixer](https://github.com/ZCube/factorio-port-fixer) including corresponding fields for values.yaml
14+
15+
### V2.0.4
16+
17+
#### Non-Breaking Changes
18+
19+
- Added new PVC labels - Thank you ohnoitsyou
20+
21+
### V2.0.3
22+
23+
#### Non-Breaking Changes
24+
25+
- Updated Chart test to wait for the service to become available before testing rcon port
26+
927
### V2.0.2
1028

1129
#### 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.0.3
23+
version: 2.1.1
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ If you do run into any issues with mods, I will try to work with you on finding
236236
| `persistence.dataDir.existingClaim` | The name of an existing PVC to use for persistence | |
237237
| `persistence.storageClassName` | Persistent Volume storage class | `""` |
238238
| `persistence.annotations` | Persistent Volume Claim annotations | `{}` |
239+
| `persistence.lables` | Persistent Volume Claim labels | `{}` |
239240
240241
### Factorio Parameters
241242

charts/factorio-server-charts/templates/datadir-pvc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ metadata:
66
name: {{ template "factorio-server-charts.fullname" . }}-datadir
77
labels:
88
app: "{{ template "factorio-server-charts.fullname" . }}-{{ .Chart.Version }}"
9+
{{- range $key, $val := .Values.persistence.labels }}
10+
{{ $key }}: {{ $val | quote }}
11+
{{- end}}
912
{{- if .Values.persistence.annotations }}
1013
annotations:
1114
{{ toYaml .Values.persistence.annotations | indent 4 }}

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

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
failureThreshold: 3
142142
ports:
143143
- name: factorio
144-
containerPort: 34197
144+
containerPort: {{ .Values.factorioServer.port }}
145145
protocol: UDP
146146
- containerPort: {{ .Values.factorioServer.rcon_port }}
147147
protocol: TCP
@@ -171,24 +171,50 @@ spec:
171171
value: {{ .Values.factorioServer.enable_space_age | quote }}
172172
- name: CONFIG
173173
value: /factorio/configs
174+
- name: PORT
175+
value: {{ .Values.factorioServer.port | quote }}
174176
- name: RCON_PORT
175177
value: {{ .Values.factorioServer.rcon_port | quote }}
176-
{{- if .Values.rcon_api.enabled }}
177-
- name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
178-
image: "{{ .Values.rcon_api.image.repository }}:{{ .Values.rcon_api.image.tag }}"
179-
imagePullPolicy: {{ .Values.rcon_api.image.pullPolicy }}
178+
{{- if .Values.port_fixer.enabled }}
179+
- name: {{ template "factorio-server-charts.fullname" . }}-port-fixer
180+
image: "{{ .Values.port_fixer.image.repository }}:{{ .Values.port_fixer.image.tag }}"
181+
imagePullPolicy: {{ .Values.port_fixer.image.pullPolicy }}
180182
{{- with .Values.securityContext }}
181183
securityContext:
182184
{{- toYaml . | nindent 10 }}
183185
{{- end }}
186+
command: ["/factorio-port-fixer"]
187+
args:
188+
- local
189+
- --ip=127.0.0.1
190+
- --port=34197
191+
- --remotePort={{ .Values.port_fixer.port | default .Values.service.port }}
184192
livenessProbe:
185193
httpGet:
186-
path: /healthz
187-
port: rcon-api
194+
path: /health
195+
port: port-fixer
188196
periodSeconds: 10
189197
initialDelaySeconds: 5
190198
failureThreshold: 3
191199
ports:
200+
- name: port-fixer
201+
containerPort: 34197
202+
protocol: TCP
203+
hostAliases:
204+
- ip: "127.0.0.1"
205+
hostnames:
206+
- pingpong1.factorio.com
207+
- pingpong2.factorio.com
208+
- pingpong3.factorio.com
209+
- pingpong4.factorio.com
210+
{{- if .Values.rcon_api.enabled }}
211+
- name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
212+
image: "{{ .Values.rcon_api.image.repository }}:{{ .Values.rcon_api.image.tag }}"
213+
imagePullPolicy: {{ .Values.rcon_api.image.pullPolicy }}
214+
livenessProbe:
215+
httpGet:
216+
path: /healthz
217+
port: rcon-api
192218
- name: rcon-api
193219
containerPort: 24180
194220
protocol: TCP

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
{{- end }}
2121
ports:
2222
- name: factorio
23-
targetPort: 34197
23+
targetPort: {{ .Values.factorioServer.port }}
2424
port: {{ .Values.service.port }}
2525
protocol: UDP
2626
{{- if eq .Values.service.type "NodePort" }}

charts/factorio-server-charts/templates/tests/test-connection.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ spec:
1212
image: outdead/rcon
1313
command:
1414
- /bin/sh
15-
- -ec
15+
- -xec
1616
- |
17+
until nc -z {{ include "factorio-server-charts.fullname" . }}-rcon {{ .Values.rcon.port }}; do
18+
echo "Waiting for main service to be ready..." >&2
19+
sleep 5
20+
done
21+
echo "Main service is ready, proceeding with connection test."
1722
RCONPW="$(cat /rconpw/rconpw)"
18-
./rcon -a {{ include "factorio-server-charts.fullname" . }}-rcon:{{ .Values.rcon.port }} -p $RCONPW -t rcon -T 180s /s Test
23+
if ./rcon -a {{ include "factorio-server-charts.fullname" . }}-rcon:{{ .Values.rcon.port }} -p $RCONPW -t rcon -T 180s /s Test; then
24+
echo "RCON test command completed successfully."
25+
else
26+
echo "RCON test failed." >&2
27+
fi
1928
volumeMounts:
2029
- mountPath: /rconpw
2130
name: rconpw

charts/factorio-server-charts/values.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ affinity: {}
106106
## @extra persistence.dataDir.existingClaim The name of an existing PVC to use for persistence
107107
## @param persistence.storageClassName Persistent Volume storage class
108108
## @param persistence.annotations Persistent Volume Claim annotations
109+
## @param persistence.labels Persistent Volume Claim labels
109110
## Sets the data persistence volume configuration
110111
## IMPORTANT: If you do not setup a PV all your savegames will be lost on pod recreation or helm upgrade
111112
persistence:
@@ -118,6 +119,8 @@ persistence:
118119
storageClassName: ""
119120
## If you have annotations to spin up a PV i.e. the location. Remove the curly braces
120121
annotations: {}
122+
## If you have additional labels to apply to the volume
123+
labels: {}
121124

122125

123126
#### Factorio application configuration ####
@@ -145,6 +148,7 @@ mods:
145148
## @param factorioServer.generate_new_save Generate a new save if `save_name` is not found
146149
## @param factorioServer.update_mods_on_start Update mods on server start
147150
## @param factorioServer.load_latest_save Lets the game know if you want to load the latest save
151+
## @param factorioServer.port Factorio Game Server port
148152
## @param factorioServer.rcon_port Factorio Server RCON port
149153
factorioServer:
150154
# name to use for the save file
@@ -157,6 +161,11 @@ factorioServer:
157161
load_latest_save: true
158162
# enables or disables the mods for DLC Space Age in mod-list.json
159163
enable_space_age: true
164+
# factorio game server port
165+
# the default game port (34197) has been changed to 31497 to resolve issues when using the port-fixer.
166+
# this port setting is typically for internal Kubernetes configuration only, and in most cases, it does not need to be modified.
167+
# if it is necessary to change the game server port where you connect to the game, update the "service.port" value accordingly.
168+
port: 31497
160169
# factorio game rcon port
161170
# this port setting is typically for internal Kubernetes configuration only, and in most cases, it does not need to be modified.
162171
# if it is necessary to change the rcon server port where you connect to it, update the "rcon.port" value accordingly.
@@ -292,6 +301,29 @@ server_settings:
292301
maximum_segment_size: 100
293302
maximum_segment_size_peer_count: 10
294303

304+
## @section Port-Fixer Parameters
305+
## @param port_fixer.enabled Enable the Factorio Port Fixer
306+
## @param image.repository Factorio port-fixer image repository
307+
## @param image.tag Factorio port fixer image tag (immutable tags are recommended)
308+
## @param image.pullPolicy Factorio port fixer image pull policy
309+
## @param image.port Factorio port to announce via port-fixer, defaults to service.port
310+
port_fixer:
311+
# Adds an extra container that tries to help with connection issues via the public server browser.
312+
# This is especially useful when you can’t set up outgoing static port mappings and see log messages like these:
313+
# > Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<ip>:19296}), expected IP ADDR:({<ip>:58037}))
314+
# > Warning ServerMultiplayerManager.cpp:651: Determining own address has failed. Best guess: IP ADDR:({<ip>:58037})
315+
# > Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<ip>:19297}), expected IP ADDR:({<ip>:58037}))
316+
# > Warning ServerRouter.cpp:541: Received own address message reply with conflicting address (got IP ADDR:({<ip>:24105}), expected IP ADDR:({<ip>:58037}))
317+
# Note: Port forwarding for incoming traffic still needs to be set up properly for this to work.
318+
# For more info, check out:
319+
# - https://github.com/SQLJames/factorio-server-charts/issues/15
320+
enabled: false
321+
image:
322+
repository: "ghcr.io/zcube/factorio-port-fixer"
323+
pullPolicy: Always
324+
tag: latest
325+
port: ''
326+
295327
## @param rcon.external Enable RCON external access (deploy RCON service)
296328
## @param rcon.type RCON service type
297329
## @param rcon.serviceAnnotations RCON service annotations

0 commit comments

Comments
 (0)