Skip to content

Commit 917b423

Browse files
committed
add factorio-port-fixer
1 parent 47871e0 commit 917b423

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
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.1.0
4+
5+
#### Non-Breaking Changes
6+
7+
- Added support for [ZCube/factorio-port-fixer](https://github.com/ZCube/factorio-port-fixer) including corresponding fields for values.yaml
8+
39
### V2.0.2
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.0.2
23+
version: 2.1.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: 36 additions & 1 deletion
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: 31497
145145
protocol: UDP
146146
- containerPort: 27015
147147
protocol: TCP
@@ -171,6 +171,41 @@ 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 }}
176+
{{- if .Values.port_fixer.enabled }}
177+
- name: {{ template "factorio-server-charts.fullname" . }}-port-fixer
178+
image: "{{ .Values.port_fixer.image.repository }}:{{ .Values.port_fixer.image.tag }}"
179+
imagePullPolicy: {{ .Values.port_fixer.image.pullPolicy }}
180+
{{- with .Values.securityContext }}
181+
securityContext:
182+
{{- toYaml . | nindent 10 }}
183+
{{- end }}
184+
command: ["/factorio-port-fixer"]
185+
args:
186+
- local
187+
- --ip=127.0.0.1
188+
- --port=34197
189+
- --remotePort={{ .Values.port_fixer.port | default .Values.service.port }}
190+
livenessProbe:
191+
httpGet:
192+
path: /health
193+
port: port-fixer
194+
periodSeconds: 10
195+
initialDelaySeconds: 5
196+
failureThreshold: 3
197+
ports:
198+
- name: port-fixer
199+
containerPort: 34197
200+
protocol: TCP
201+
hostAliases:
202+
- ip: "127.0.0.1"
203+
hostnames:
204+
- pingpong1.factorio.com
205+
- pingpong2.factorio.com
206+
- pingpong3.factorio.com
207+
- pingpong4.factorio.com
208+
{{- end }}
174209
{{- if .Values.nodeSelector }}
175210
nodeSelector:
176211
{{ toYaml .Values.nodeSelector | indent 8 }}

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 | quote }}
2424
port: {{ .Values.service.port }}
2525
protocol: UDP
2626
{{- if eq .Values.service.type "NodePort" }}

charts/factorio-server-charts/values.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ mods:
145145
## @param factorioServer.generate_new_save Generate a new save if `save_name` is not found
146146
## @param factorioServer.update_mods_on_start Update mods on server start
147147
## @param factorioServer.load_latest_save Lets the game know if you want to load the latest save
148+
## @param factorioServer.port Factorio Game Server port
148149
factorioServer:
149150
# name to use for the save file
150151
save_name: "replaceMe"
@@ -156,6 +157,11 @@ factorioServer:
156157
load_latest_save: true
157158
# enables or disables the mods for DLC Space Age in mod-list.json
158159
enable_space_age: true
160+
# factorio game server port
161+
# the default game port (34197) has been changed to 31497 to resolve issues when using the port-fixer.
162+
# this port setting is typically for internal Kubernetes configuration only, and in most cases, it does not need to be modified.
163+
# if it is necessary to change the game server port where you connect to the game, update the "service.port" value accordingly.
164+
port: 31497
159165

160166
import_save:
161167
# enable save importer
@@ -287,6 +293,29 @@ server_settings:
287293
maximum_segment_size: 100
288294
maximum_segment_size_peer_count: 10
289295

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

0 commit comments

Comments
 (0)