Skip to content

Commit 0e28d7c

Browse files
committed
add rcon-rest-api container
1 parent 47871e0 commit 0e28d7c

File tree

6 files changed

+157
-2
lines changed

6 files changed

+157
-2
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.0.3
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.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.0.3
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: 39 additions & 1 deletion
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 }}"
@@ -171,6 +171,44 @@ spec:
171171
value: {{ .Values.factorioServer.enable_space_age | quote }}
172172
- name: CONFIG
173173
value: /factorio/configs
174+
{{- if .Values.rcon_api.enabled }}
175+
- name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
176+
image: "{{ .Values.rcon_api.image.repository }}:{{ .Values.rcon_api.image.tag }}"
177+
imagePullPolicy: {{ .Values.image.pullPolicy }}
178+
{{- with .Values.securityContext }}
179+
securityContext:
180+
{{- toYaml . | nindent 10 }}
181+
{{- end }}
182+
livenessProbe:
183+
exec:
184+
command:
185+
- sh
186+
- -c
187+
- curl -s localhost:24180/api/v1/factorio/console/command/version | grep -q -E '{"version":".*"}'
188+
periodSeconds: 10
189+
initialDelaySeconds: 5
190+
failureThreshold: 3
191+
ports:
192+
- name: rcon-api
193+
containerPort: 24180
194+
protocol: TCP
195+
- containerPort: 24181
196+
protocol: TCP
197+
env:
198+
- name: FACTORIO_RCON_HOST
199+
value: "localhost"
200+
- name: FACTORIO_RCON_PORT
201+
value: "27015"
202+
- name: FACTORIO_RCON_PASSWORD
203+
{{- if .Values.rcon.passwordSecret }}
204+
valueFrom:
205+
secretKeyRef:
206+
name: {{ .Values.rcon.passwordSecret }}
207+
key: rconpw
208+
{{- else }}
209+
value: {{ .Values.rcon.password | quote }}
210+
{{- end }}
211+
{{- end }}
174212
{{- if .Values.nodeSelector }}
175213
nodeSelector:
176214
{{ 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.rcon_api.enabled .Values.rcon_api.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.rcon_api.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.rcon_api.ingress.className }}
17+
rules:
18+
- host: {{ .Values.rcon_api.ingress.hostname }}
19+
http:
20+
paths:
21+
- backend:
22+
service:
23+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
24+
port:
25+
number: {{ .Values.rcon_api.httpPort }}
26+
path: /
27+
pathType: Prefix
28+
- backend:
29+
service:
30+
name: {{ template "factorio-server-charts.fullname" . }}-rcon-api
31+
port:
32+
number: {{ .Values.rcon_api.grpcPort }}
33+
path: /grpc
34+
pathType: Prefix
35+
{{- if and .Values.rcon_api.ingress.tls.enabled .Values.rcon_api.ingress.tls.secretName }}
36+
tls:
37+
- hosts:
38+
- {{ .Values.rcon_api.ingress.hostname }}
39+
secretName: {{ .Values.rcon_api.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.rcon_api.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.rcon_api.serviceAnnotations }}
13+
{{ $key }}: {{ $value | quote }}
14+
{{- end }}
15+
spec:
16+
type: {{ .Values.rcon_api.type }}
17+
ports:
18+
- name: http
19+
port: {{ .Values.rcon_api.httpPort }}
20+
targetPort: 24180
21+
{{- if eq .Values.rcon_api.type "NodePort" }}
22+
nodePort: {{ .Values.rcon_api.httpPort }}
23+
{{- end }}
24+
protocol: TCP
25+
- name: grpc
26+
port: {{ .Values.rcon_api.grpcPort }}
27+
targetPort: 24181
28+
{{- if eq .Values.rcon_api.type "NodePort" }}
29+
nodePort: {{ .Values.rcon_api.grpcPort }}
30+
{{- end }}
31+
protocol: TCP
32+
selector:
33+
app: {{ template "factorio-server-charts.fullname" . }}
34+
{{- end }}

charts/factorio-server-charts/values.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,42 @@ rcon:
307307
# rcon port
308308
port: 30100
309309

310+
## @param rcon_api.enabled Enable or disable the RCON API service
311+
## @param rcon_api.image.repository RCON-API image repository
312+
## @param rcon_api.image.tag RCON-API image tag (immutable tags are recommended)
313+
## @param rcon_api.image.pullPolicy RCON-API image pull policy
314+
## @param rcon_api.type Kubernetes service type for the RCON API (e.g., ClusterIP, NodePort, LoadBalancer)
315+
## @param rcon_api.serviceAnnotations Annotations to add to the RCON API service
316+
## @param rcon_api.httpPort Internal port on which the HTTP API for RCON is exposed
317+
## @param rcon_api.grpcPort Internal port on which the gRPC API for RCON is exposed
318+
## @param rcon_api.ingress.enabled Enable or disable the Ingress for the RCON API service
319+
## @param rcon_api.ingress.hostname Hostname for the RCON API Ingress
320+
## @param rcon_api.ingress.className Ingress class name for selecting the Ingress controller (e.g., nginx, cilium)
321+
## @param rcon_api.ingress.annotations Additional annotations for the Ingress resource
322+
## @param rcon_api.ingress.tls.enabled Enable or disable TLS for the Ingress
323+
## @param rcon_api.ingress.tls.secretName Kubernetes Secret name for TLS certificates used by the Ingress
324+
rcon_api:
325+
enabled: false
326+
image:
327+
repository: "ghcr.io/nekomeowww/factorio-rcon-api"
328+
pullPolicy: Always
329+
tag: latest
330+
type: ClusterIP
331+
serviceAnnotations: {}
332+
httpPort: 30110
333+
grpcPort: 30111
334+
335+
ingress:
336+
enabled: true
337+
hostname: "factorio.example.com"
338+
className: "nginx"
339+
annotations:
340+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
341+
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
342+
tls:
343+
enabled: true
344+
secretName: "cert-factorio.example.com"
345+
310346
## @param map_gen_settings.width Map width in tiles; 0 means infinite
311347
## @param map_gen_settings.height Map height in tiles; 0 means infinite
312348
## @param map_gen_settings.starting_area Multiplier for biter free zone radius

0 commit comments

Comments
 (0)