Skip to content

Commit d19bdfa

Browse files
authored
Merge pull request #57 from Kariton/factorio-rcon-api
add rcon-rest-api container
2 parents 8aea01d + 2a07975 commit d19bdfa

File tree

7 files changed

+158
-6
lines changed

7 files changed

+158
-6
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.2.0
4+
5+
#### Non-Breaking Changes
6+
7+
- Added support for [nekomeowww/factorio-rcon-api](https://github.com/nekomeowww/factorio-rcon-api) including corresponding fields for values.yaml
8+
39
### V2.1.0
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.1.0
23+
version: 2.2.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: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ spec:
121121
mountPath: /factorio
122122
- name: {{ template "factorio-server-charts.fullname" . }}-save-importer-configmap
123123
mountPath: /scripts
124-
{{- end }}
124+
{{- end }}
125125
containers:
126126
- name: {{ template "factorio-server-charts.fullname" . }}
127127
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -143,7 +143,7 @@ spec:
143143
- name: factorio
144144
containerPort: {{ .Values.factorioServer.port }}
145145
protocol: UDP
146-
- containerPort: 27015
146+
- containerPort: {{ .Values.factorioServer.rcon_port }}
147147
protocol: TCP
148148
resources:
149149
{{ toYaml .Values.resources | indent 10 }}
@@ -173,6 +173,8 @@ spec:
173173
value: /factorio/configs
174174
- name: PORT
175175
value: {{ .Values.factorioServer.port | quote }}
176+
- name: RCON_PORT
177+
value: {{ .Values.factorioServer.rcon_port | quote }}
176178
{{- if .Values.port_fixer.enabled }}
177179
- name: {{ template "factorio-server-charts.fullname" . }}-port-fixer
178180
image: "{{ .Values.port_fixer.image.repository }}:{{ .Values.port_fixer.image.tag }}"
@@ -206,6 +208,34 @@ spec:
206208
- pingpong3.factorio.com
207209
- pingpong4.factorio.com
208210
{{- end }}
211+
{{- if .Values.rconAPI.enabled }}
212+
- name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
213+
image: "{{ .Values.rconAPI.image.repository }}:{{ .Values.rconAPI.image.tag }}"
214+
imagePullPolicy: {{ .Values.rconAPI.image.pullPolicy }}
215+
livenessProbe:
216+
httpGet:
217+
path: /healthz
218+
port: rcon-api
219+
- name: rcon-api
220+
containerPort: 24180
221+
protocol: TCP
222+
- containerPort: 24181
223+
protocol: TCP
224+
env:
225+
- name: FACTORIO_RCON_HOST
226+
value: "localhost"
227+
- name: FACTORIO_RCON_PORT
228+
value: {{ .Values.factorioServer.rcon_port | quote }}
229+
- name: FACTORIO_RCON_PASSWORD
230+
{{- if .Values.rcon.passwordSecret }}
231+
valueFrom:
232+
secretKeyRef:
233+
name: {{ .Values.rcon.passwordSecret }}
234+
key: rconpw
235+
{{- else }}
236+
value: {{ .Values.rcon.password | quote }}
237+
{{- end }}
238+
{{- end }}
209239
{{- if .Values.nodeSelector }}
210240
nodeSelector:
211241
{{ toYaml .Values.nodeSelector | indent 8 }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if and .Values.rconAPI.enabled .Values.rconAPI.ingress.enabled }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
6+
annotations:
7+
{{- range $key, $value := .Values.rconAPI.ingress.annotations }}
8+
{{ $key }}: {{ $value | quote }}
9+
{{- end }}
10+
labels:
11+
app: {{ template "factorio-server-charts.fullname" . }}
12+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
13+
release: "{{ .Release.Name }}"
14+
heritage: "{{ .Release.Service }}"
15+
spec:
16+
ingressClassName: {{ .Values.rconAPI.ingress.className }}
17+
rules:
18+
- host: {{ .Values.rconAPI.ingress.hostname }}
19+
http:
20+
paths:
21+
- backend:
22+
service:
23+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
24+
port:
25+
number: {{ .Values.rconAPI.httpPort }}
26+
path: /
27+
pathType: Prefix
28+
- backend:
29+
service:
30+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
31+
port:
32+
number: {{ .Values.rconAPI.grpcPort }}
33+
path: /grpc
34+
pathType: Prefix
35+
{{- if and .Values.rconAPI.ingress.tls.enabled .Values.rconAPI.ingress.tls.secretName }}
36+
tls:
37+
- hosts:
38+
- {{ .Values.rconAPI.ingress.hostname }}
39+
secretName: {{ .Values.rconAPI.ingress.tls.secretName }}
40+
{{- end }}
41+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.rconAPI.enabled }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
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.rconAPI.serviceAnnotations }}
13+
{{ $key }}: {{ $value | quote }}
14+
{{- end }}
15+
spec:
16+
type: {{ .Values.rconAPI.type }}
17+
ports:
18+
- name: http
19+
port: {{ .Values.rconAPI.httpPort }}
20+
targetPort: 24180
21+
{{- if eq .Values.rconAPI.type "NodePort" }}
22+
nodePort: {{ .Values.rconAPI.httpPort }}
23+
{{- end }}
24+
protocol: TCP
25+
- name: grpc
26+
port: {{ .Values.rconAPI.grpcPort }}
27+
targetPort: 24181
28+
{{- if eq .Values.rconAPI.type "NodePort" }}
29+
nodePort: {{ .Values.rconAPI.grpcPort }}
30+
{{- end }}
31+
protocol: TCP
32+
selector:
33+
app: {{ template "factorio-server-charts.fullname" . }}
34+
{{- end }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
ports:
1818
- name: rcon
1919
port: {{ .Values.rcon.port }}
20-
targetPort: 27015
20+
targetPort: {{ .Values.factorioServer.rcon_port }}
2121
{{- if eq .Values.rcon.type "NodePort" }}
2222
nodePort: {{ .Values.rcon.port}}
2323
{{- end }}

charts/factorio-server-charts/values.yaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ mods:
149149
## @param factorioServer.update_mods_on_start Update mods on server start
150150
## @param factorioServer.load_latest_save Lets the game know if you want to load the latest save
151151
## @param factorioServer.port Factorio Game Server port
152+
## @param factorioServer.rcon_port Factorio Server RCON port
152153
factorioServer:
153154
# name to use for the save file
154155
save_name: "replaceMe"
@@ -165,6 +166,10 @@ factorioServer:
165166
# this port setting is typically for internal Kubernetes configuration only, and in most cases, it does not need to be modified.
166167
# if it is necessary to change the game server port where you connect to the game, update the "service.port" value accordingly.
167168
port: 31497
169+
# factorio game rcon port
170+
# this port setting is typically for internal Kubernetes configuration only, and in most cases, it does not need to be modified.
171+
# if it is necessary to change the rcon server port where you connect to it, update the "rcon.port" value accordingly.
172+
rcon_port: 27015
168173

169174
import_save:
170175
# enable save importer
@@ -322,15 +327,15 @@ port_fixer:
322327
## @param rcon.external Enable RCON external access (deploy RCON service)
323328
## @param rcon.type RCON service type
324329
## @param rcon.serviceAnnotations RCON service annotations
325-
## @param rcon.passwordSecret Existing secret containing a `password` data field
330+
## @param rcon.passwordSecret Existing secret containing a `rconpw` data field
326331
## @param rcon.password Password for RCON, ignored if `rcon.passwordSecret` is set
327332
## @param rcon.port RCON service external port
328333
# Password and port for the rcon service
329334
rcon:
330335
external: true
331336
type: LoadBalancer
332337
serviceAnnotations: {}
333-
# Existing secret containing a `password` data field
338+
# Existing secret containing a `rconpw` data field
334339
passwordSecret: ""
335340

336341
# Password for rcon
@@ -339,6 +344,42 @@ rcon:
339344
# rcon port
340345
port: 30100
341346

347+
## @param rconAPI.enabled Enable or disable the RCON API service
348+
## @param rconAPI.image.repository RCON-API image repository
349+
## @param rconAPI.image.tag RCON-API image tag (immutable tags are recommended)
350+
## @param rconAPI.image.pullPolicy RCON-API image pull policy
351+
## @param rconAPI.type Kubernetes service type for the RCON API (e.g., ClusterIP, NodePort, LoadBalancer)
352+
## @param rconAPI.serviceAnnotations Annotations to add to the RCON API service
353+
## @param rconAPI.httpPort Internal port on which the HTTP API for RCON is exposed
354+
## @param rconAPI.grpcPort Internal port on which the gRPC API for RCON is exposed
355+
## @param rconAPI.ingress.enabled Enable or disable the Ingress for the RCON API service
356+
## @param rconAPI.ingress.hostname Hostname for the RCON API Ingress
357+
## @param rconAPI.ingress.className Ingress class name for selecting the Ingress controller (e.g., nginx, cilium)
358+
## @param rconAPI.ingress.annotations Additional annotations for the Ingress resource
359+
## @param rconAPI.ingress.tls.enabled Enable or disable TLS for the Ingress
360+
## @param rconAPI.ingress.tls.secretName Kubernetes Secret name for TLS certificates used by the Ingress
361+
rconAPI:
362+
enabled: false
363+
image:
364+
repository: "ghcr.io/nekomeowww/factorio-rcon-api"
365+
pullPolicy: Always
366+
tag: latest
367+
type: ClusterIP
368+
serviceAnnotations: {}
369+
httpPort: 30110
370+
grpcPort: 30111
371+
372+
ingress:
373+
enabled: true
374+
hostname: "factorio.example.com"
375+
className: "nginx"
376+
annotations:
377+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
378+
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
379+
tls:
380+
enabled: false
381+
secretName: "cert-factorio.example.com"
382+
342383
## @param map_gen_settings.width Map width in tiles; 0 means infinite
343384
## @param map_gen_settings.height Map height in tiles; 0 means infinite
344385
## @param map_gen_settings.starting_area Multiplier for biter free zone radius

0 commit comments

Comments
 (0)