Skip to content

Commit 789127d

Browse files
author
James Rhoat
committed
updating the deployment to work with host networking for public play
1 parent c6a4d78 commit 789127d

File tree

8 files changed

+169
-469
lines changed

8 files changed

+169
-469
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 74 additions & 226 deletions
Large diffs are not rendered by default.

charts/factorio-server-charts/README.md

Lines changed: 49 additions & 224 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spec:
1919
labels:
2020
app: {{ template "factorio-server-charts.fullname" . }}
2121
spec:
22+
hostNetwork: true
2223
initContainers:
2324
- name: volume-permissions-serversettingsconfig
2425
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -93,10 +94,10 @@ spec:
9394
value: {{ .Values.service.port | quote }}
9495
- name: CONFIG
9596
value: /factorio/configs
96-
{{- with .Values.nodeSelector }}
97+
{{- if .Values.nodeSelector }}
9798
nodeSelector:
98-
{{- toYaml . | nindent 8 }}
99-
{{- end }}
99+
{{ toYaml .Values.nodeSelector | indent 8 }}
100+
{{- end }}
100101
volumes:
101102
- name: datadir
102103
{{- if .Values.persistence.enabled }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- if .Values.rcon.external }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ template "factorio-server-charts.fullname" . }}-rcon
6+
labels:
7+
app: {{ template "factorio-server-charts.fullname" . }}
8+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
9+
release: "{{ .Release.Name }}"
10+
heritage: "{{ .Release.Service }}"
11+
annotations:
12+
{{- range $key, $value := .Values.service.annotations }}
13+
{{ $key }}: {{ $value | quote }}
14+
{{- end }}
15+
spec:
16+
type: {{ .Values.rcon.type }}
17+
ports:
18+
- name: rcon
19+
port: {{ .Values.rcon.port }}
20+
nodePort: {{ .Values.rcon.port}}
21+
protocol: TCP
22+
selector:
23+
app: {{ template "factorio-server-charts.fullname" . }}
24+
{{- end }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
port: {{ .Values.service.port }}
1919
targetPort: {{ .Values.service.port }}
2020
protocol: UDP
21-
nodePort: {{ default "" .Values.service.nodePort}}
21+
#nodePort: {{ .Values.service.port}}
2222
selector:
2323
app: {{ template "factorio-server-charts.fullname" . }}
2424
{{- if .Values.service.externalIPs }}

charts/factorio-server-charts/values.yaml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@ image:
1212
## You should set an fix version, i.e.:
1313
# tag: "1.1.37"
1414

15+
nodeSelector: {}
16+
# beta.kubernetes.io/os: linux
17+
# beta.kubernetes.io/arch: amd64
18+
# kubernetes.io/hostname: your-cool-hostname
1519

1620

1721
## The service is a kind tricky, so factorio uses UDP, but not every cloud provider is able to route UDP traffic.
18-
## I.e. your cloud provider has LoadBalancers without the ability for UPD protocoll. Furthermore kubectl ist not able to route UDP Traffic
22+
## I.e. your cloud provider has LoadBalancers without the ability for UDP protocol. Furthermore kubectl ist not able to route UDP Traffic
1923
## ref: https://github.com/kubernetes/kubernetes/issues/47862
20-
## 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.
21-
## 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!
24+
## You have to expose factorio on a NodePort and map a port between 30000 and 32767, but the native port is 34197. So you have always to specify the port in factorio.
25+
## 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 pod runs on !
2226
service:
23-
type: LoadBalancer
24-
port: 30000
25-
## If you are able in your cluster to map an external IP, set it here
27+
type: NodePort
28+
port: 31497
29+
## If you are able to map an external IP, set it here
2630
# externalIPs:
27-
# - "192.168.0.1"
28-
# - "192.168.0.2"
31+
# - "192.168.0.1"
32+
# - "192.168.0.2"
33+
#
34+
#
2935
## If you use "type: NodePort" set the port to a value you like in the range of 30000-32767. Leave it blank for a random port
3036
# nodePort: ""
3137
## Examples:
@@ -51,11 +57,6 @@ resources:
5157
# memory: 1024Mi
5258
# cpu: 1000m
5359

54-
# Node labels for pod assignment. Remove the curly braces!
55-
nodeSelector: {}
56-
# beta.kubernetes.io/os: linux
57-
# beta.kubernetes.io/arch: amd64
58-
# kubernetes.io/hostname: your-cool-hostname
5960

6061
## Strategy used to replace old pods
6162
## IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes
@@ -181,8 +182,10 @@ server_settings:
181182

182183
# Password and port for the rcon service
183184
rcon:
185+
external: true
186+
type: LoadBalancer
184187
password: "abcdefghijklmno"
185-
port: 27015
188+
port: 30100
186189

187190
map_gen_settings:
188191
#The inverse of water scale in the map generator GUI.

helm-output.yaml

26 KB
Binary file not shown.

0 commit comments

Comments
 (0)