Files
factorio/factorio.yaml
T
feedc0de bf806c886c
Validate, publish and promote Factorio chart / chart (push) Failing after 10s
Publish Factorio deployment as a Helm chart
2026-10-27 07:16:05 +01:00

268 lines
6.9 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: factorio
namespace: {{ .Release.Namespace }}
labels: &id001
app.kubernetes.io/name: factorio
spec:
replicas: 1
revisionHistoryLimit: 5
progressDeadlineSeconds: 1800
strategy:
type: Recreate
selector:
matchLabels: *id001
template:
metadata:
labels: *id001
annotations:
factorio.brunner.ninja/config-revision: {{ printf "%s%s%s%s%s%s" (.Files.Get "scripts/start.sh") (.Files.Get "scripts/health.sh") (.Files.Get "scripts/collect.sh") (.Files.Get "scripts/collector-health.sh") (.Files.Get "server-settings.json") (.Files.Get "server-adminlist.json") | sha256sum }}
spec:
automountServiceAccountToken: false
terminationGracePeriodSeconds: 180
securityContext:
seccompProfile:
type: RuntimeDefault
fsGroup: 845
fsGroupChangePolicy: OnRootMismatch
{{ with .Values.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{ end }}
{{ with .Values.tolerations }}
tolerations:
{{ toYaml . | nindent 8 }}
{{ end }}
containers:
- name: factorio
image: docker.io/factoriotools/factorio:{{ .Chart.AppVersion }}
command:
- /scripts/start.sh
env:
- name: TZ
value: Europe/Vienna
- name: DLC_SPACE_AGE
value: 'false'
ports:
- name: game-udp
containerPort: 34197
protocol: UDP
- name: rcon
containerPort: 27015
startupProbe:
exec: &id002
command:
- /scripts/health.sh
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 80
readinessProbe:
exec: *id002
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 4
livenessProbe:
exec: *id002
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 10
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- timeout 90 rcon /server-save || true
{{ with .Values.resources.factorio }}
resources:
{{ toYaml . | nindent 10 }}
{{ end }}
securityContext:
allowPrivilegeEscalation: false
volumeMounts:
- name: data
mountPath: /factorio
- name: scripts
mountPath: /scripts
readOnly: true
- name: settings
mountPath: /settings
readOnly: true
- name: credentials
mountPath: /credentials
readOnly: true
- name: player-collector
image: docker.io/factoriotools/factorio:{{ .Chart.AppVersion }}
command:
- /scripts/collect.sh
env:
- name: CONFIG
value: /factorio/config
startupProbe:
exec: &id003
command:
- /scripts/collector-health.sh
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 12
readinessProbe: &id004
exec: *id003
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 3
livenessProbe: *id004
{{ with .Values.resources.collector }}
resources:
{{ toYaml . | nindent 10 }}
{{ end }}
securityContext: &id007
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 845
runAsGroup: 845
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
volumeMounts:
- name: scripts
mountPath: /scripts
readOnly: true
- name: rcon-collector
mountPath: /factorio/config
readOnly: true
- name: metrics
mountPath: /metrics
- name: exporter
image: {{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}
args:
- --web.listen-address=:9772
- --collector.disable-defaults
- --collector.textfile
- --collector.textfile.directory=/metrics
ports:
- name: metrics
containerPort: 9772
startupProbe:
httpGet: &id005
path: /
port: metrics
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 12
readinessProbe: &id006
httpGet: *id005
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 3
livenessProbe: *id006
{{ with .Values.resources.exporter }}
resources:
{{ toYaml . | nindent 10 }}
{{ end }}
securityContext: *id007
volumeMounts:
- name: metrics
mountPath: /metrics
readOnly: true
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default "factorio-data" }}
- name: scripts
configMap:
name: factorio-scripts
defaultMode: 365
- name: settings
configMap:
name: factorio-settings
- name: credentials
secret:
secretName: {{ .Values.credentials.secretName }}
defaultMode: 256
- name: metrics
emptyDir:
sizeLimit: 16Mi
- name: rcon-collector
secret:
secretName: {{ .Values.credentials.secretName }}
defaultMode: 288
items:
- key: rcon-password
path: rconpw
{{ if not .Values.persistence.existingClaim }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: factorio-data
namespace: {{ .Release.Namespace }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{ with .Values.persistence.storageClassName }}
storageClassName: {{ . | quote }}
{{ end }}
{{ end }}
---
apiVersion: v1
kind: Service
metadata:
name: factorio
namespace: {{ .Release.Namespace }}
labels: &id001
app.kubernetes.io/name: factorio
{{ with .Values.service.annotations }}
annotations:
{{ toYaml . | nindent 4 }}
{{ end }}
spec:
type: LoadBalancer
ports:
- name: game-udp
port: 34197
targetPort: game-udp
protocol: UDP
selector: *id001
---
apiVersion: v1
kind: Service
metadata:
name: factorio-funkfeuer
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: factorio
spec:
type: ClusterIP
{{ with .Values.funkfeuerService.externalIPs }}
externalIPs:
{{ toYaml . | nindent 4 }}
{{ end }}
ports:
- name: game-udp
port: 34197
targetPort: game-udp
protocol: UDP
selector:
app.kubernetes.io/name: factorio
---
apiVersion: v1
kind: Service
metadata:
name: factorio-metrics
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: factorio
app.kubernetes.io/component: metrics
spec:
ports:
- name: metrics
port: 9772
targetPort: metrics
selector:
app.kubernetes.io/name: factorio