Skip to content

Commit 1346681

Browse files
author
James Rhoat
authored
Merge pull request #8 from nippold/main
Multiple improvements
2 parents 794ee84 + 329f801 commit 1346681

File tree

8 files changed

+151
-37
lines changed

8 files changed

+151
-37
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/values.yaml

charts/factorio-server-charts/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ keywords:
1515
- game
1616
- server
1717
- headless
18-
sources:
18+
sources:
1919
- https://github.com/SQLJames/factorio-server-charts
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: 1.0.7
23+
version: 1.0.8
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/Settings-Configmap.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ metadata:
99
heritage: "{{ .Release.Service }}"
1010
data:
1111
server-settings.json: |
12-
{{ toJson .Values.serverSettings | indent 4 }}
12+
{{ toJson .Values.server_settings | indent 4 }}
1313
rconpw: |
1414
{{ .Values.rcon.password | indent 4 }}
15-
map-gen-settings.json: |
15+
map-gen-settings.json: |
1616
{{ toJson .Values.map_gen_settings | indent 4 }}
17-
map-settings.json: |
18-
{{ toJson .Values.map_settings | indent 4 }}
17+
map-settings.json: |
18+
{{ toJson .Values.map_settings | indent 4 }}
19+
server-adminlist.json: |
20+
{{ toJson .Values.admin_list | indent 4 }}
21+
server-whitelist.json: |
22+
{{ toJson .Values.white_list | indent 4 }}
23+
server-banlist.json: |
24+
{{ toJson .Values.ban_list | indent 4 }}
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1+
{{- if .Values.persistence.enabled -}}
12
{{ if not .Values.persistence.dataDir.existingClaim }}
23
kind: PersistentVolumeClaim
34
apiVersion: v1
45
metadata:
56
name: {{ template "factorio-server-charts.fullname" . }}-datadir
67
labels:
78
app: "{{ template "factorio-server-charts.fullname" . }}-{{ .Chart.Version }}"
9+
{{- if .Values.persistence.annotations }}
10+
annotations:
11+
{{ toYaml .Values.persistence.annotations | indent 4 }}
12+
{{- end }}
813
spec:
914
accessModes:
1015
- ReadWriteOnce
1116
resources:
1217
requests:
1318
storage: {{ .Values.persistence.dataDir.Size | quote }}
14-
storageClassName: "{{ .Values.persistence.storageClass }}"
15-
{{ end }}
19+
{{- if .Values.persistence.storageClassName }}
20+
{{- if (eq "-" .Values.persistence.storageClassName) }}
21+
storageClassName: ""
22+
{{- else }}
23+
storageClassName: "{{ .Values.persistence.storageClassName }}"
24+
{{- end }}
25+
{{- end }}
26+
{{ end }}
27+
{{- end -}}

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ spec:
1212
selector:
1313
matchLabels:
1414
app: {{ template "factorio-server-charts.fullname" . }}
15+
strategy:
16+
{{ toYaml .Values.strategy | indent 4 }}
1517
template:
1618
metadata:
1719
labels:
@@ -34,6 +36,8 @@ spec:
3436
protocol: UDP
3537
- containerPort: {{ .Values.rcon.port }}
3638
protocol: TCP
39+
resources:
40+
{{ toYaml .Values.resources | indent 10 }}
3741
volumeMounts:
3842
- name: datadir
3943
mountPath: /factorio
@@ -43,11 +47,11 @@ spec:
4347
- name: UPDATE_MODS_ON_START
4448
value: {{ .Values.factorioServer.update_mods_on_start | quote }}
4549
- name: INSTANCE_NAME
46-
value: {{ .Values.serverSettings.name | quote }} # {{ .Values.factorioServer.instance_name | quote}}
47-
- name: INSTANCE_DESC
48-
value: {{ .Values.serverSettings.description | quote }} # {{ .Values.factorioServer.instance_description | quote}}
50+
value: {{ .Values.server_settings.name | quote }}
51+
- name: INSTANCE_DESC
52+
value: {{ .Values.server_settings.description | quote }}
4953
- name: SAVE_NAME
50-
value: {{ .Values.factorioServer.save_name | quote }} # {{ .Values.factorioServer.save_name | quote}}
54+
value: {{ .Values.factorioServer.save_name | quote }}
5155
- name: GENERATE_NEW_SAVE
5256
value: {{ .Values.factorioServer.generate_new_save | quote }}
5357
- name: LOAD_LATEST_SAVE
@@ -56,10 +60,19 @@ spec:
5660
value: {{ .Values.service.port | quote }}
5761
- name: CONFIG
5862
value: {{ .Values.factorioServer.config_path | quote }}
63+
{{- with .Values.nodeSelector }}
64+
nodeSelector:
65+
{{- toYaml . | nindent 8 }}
66+
{{- end }}
5967
volumes:
6068
- name: datadir
69+
{{- if .Values.persistence.enabled }}
6170
persistentVolumeClaim:
6271
claimName: {{ if .Values.persistence.dataDir.existingClaim }} {{.Values.persistence.dataDir.existingClaim}} {{ else }}{{ template "factorio-server-charts.fullname" . }}-datadir {{ end }}
72+
{{- else }}
73+
emptyDir: {}
74+
{{- end }}
6375
- name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig
6476
configMap:
65-
name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig
77+
name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig
78+

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ spec:
1414
port: {{ .Values.service.port }}
1515
targetPort: {{ .Values.service.port }}
1616
protocol: UDP
17+
nodePort: {{ default "" .Values.service.nodePort}}
1718
selector:
1819
app: {{ template "factorio-server-charts.fullname" . }}
20+
{{- if .Values.service.externalIPs }}
21+
externalIPs:
22+
{{ toYaml .Values.service.externalIPs | indent 4 }}
23+
{{- end }}

charts/factorio-server-charts/values.yaml

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,99 @@
11

2-
# Number of replicas to create (only 1 is supported)
2+
#### K8s configuration ####
3+
4+
## Number of replicas to create (only 1 is supported)
35
replicaCount: 1
46

57
image:
68
repository: "factoriotools/factorio"
7-
# Container image pull policy
9+
## Container image pull policy
810
pullPolicy: Always
9-
# Overrides the image tag whose default is the chart appVersion.
11+
## Overrides the image tag whose default is the chart appVersion.
1012
tag: "latest"
13+
## You should set an fix version, i.e.:
14+
# tag: "1.1.37"
1115

1216
# Security options the operator container should run with
1317
securityContext:
1418
runAsUser: 1000
1519
fsGroup: 2000
1620

21+
## The service is a kind tricky, so factorio uses UDP, but not every cloud provider is able to route UDP traffic.
22+
## I.e. your cloud provider has LoadBalancers without the ability for UPD protocoll. Furthermore kubectl ist not able to route UDP Traffic
23+
## ref: https://github.com/kubernetes/kubernetes/issues/47862
24+
## 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.
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 runs the pod!
1726
service:
18-
type: LoadBalancer
19-
port: 30000
20-
# Compute Resources required by the operator container
21-
resources: # +doc-gen:break
27+
type: ClusterIP
28+
port: 34197
29+
## If you are able in your cluster to map an external IP, set it here
30+
# externalIPs:
31+
# - "192.168.0.1"
32+
# - "192.168.0.2"
33+
## 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
34+
# nodePort: ""
35+
## Examples:
36+
## NodePort setup
37+
# type: NodePort
38+
# nodePort: ""
39+
## ClusterIp setup
40+
# ClusterIP:
41+
# port: 34197
42+
## LoadBalancer setup
43+
# type: LoadBalancer
44+
45+
46+
## Compute Resources required by the operator container
47+
resources:
48+
## We have to ensure that factorio have enough computing resources avaiable. We set here an absolute minimum
49+
## Keep in mind that big factorio base can consume a lot of memory and cpu
2250
requests:
2351
memory: 512Mi
2452
cpu: 500m
25-
# Node labels for pod assignment
26-
# Example:
27-
# nodeSelector:
53+
## If you like to limit factiorio resources
54+
# limits:
55+
# memory: 1024Mi
56+
# cpu: 1000m
57+
58+
# Node labels for pod assignment. Remove the curly braces!
59+
nodeSelector: {}
2860
# beta.kubernetes.io/os: linux
2961
# beta.kubernetes.io/arch: amd64
30-
nodeSelector: {} # +doc-gen:break
62+
# kubernetes.io/hostname: your-cool-hostname
63+
64+
## Strategy used to replace old pods
65+
## IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes
66+
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
67+
strategy:
68+
type: Recreate
69+
# type: RollingUpdate
70+
# rollingUpdate:
71+
# maxSurge: 1
72+
# maxUnavailable: 0
3173

3274
# Tolerations for pod assignment
3375
tolerations: []
3476

3577
# Affinity rules for pod assignment
3678
affinity: {}
3779

38-
# Sets the data persistence volume configuration
80+
## Sets the data persistence volume configuration
81+
## IMPORTANT: If you do not setup a PV all your savegames will be lost on pod recreation or helm upgrade
3982
persistence:
40-
dataDir:
83+
enabled: false
84+
dataDir:
4185
Size: "1Gi"
42-
existingClaim:
43-
storageClass: longhorn
86+
## If you have an existing claim, set your name here
87+
# existingClaim: "existing-claim-name"
88+
## If you like to use a specific storageClassName, set the name. Leave it blank for the default class
89+
storageClassName: ""
90+
## If you have annotations to spin up a PV i.e. the location. Remove the curly braces
91+
annotations: {}
92+
93+
94+
95+
#### factorio application configuration ####
96+
4497
factorioServer:
4598
# specify a save name
4699
save_name: "replaceMe"
@@ -51,9 +104,9 @@ factorioServer:
51104
# lets the game know if you want to load the latest save
52105
load_latest_save: true
53106
# Location of the configuration files that are generated
54-
config_path: /srv
107+
config_path: /srv
55108

56-
serverSettings:
109+
server_settings:
57110
# Your Instance Name
58111
name: Factorio
59112
# Your Instance Description
@@ -66,7 +119,7 @@ serverSettings:
66119
# Game visibility
67120
visibility:
68121
# Game will be published on the official Factorio matching server
69-
public: true
122+
public: false
70123
# Game will be broadcast on LAN
71124
lan: true
72125
# Your factorio.com login credentials. Required for games with visibility public
@@ -77,7 +130,7 @@ serverSettings:
77130
# password required to log into the factorio server
78131
game_password: ''
79132
# When set to true, the server will only allow clients that have a valid Factorio.com account
80-
require_user_verification: true
133+
require_user_verification: false
81134
# optional, default value is 0. 0 means unlimited.
82135
max_upload_in_kilobytes_per_second: 0
83136
# optional, default value is 5. 0 means unlimited.
@@ -118,7 +171,7 @@ serverSettings:
118171

119172
# Password and port for the rcon service
120173
rcon:
121-
password: "01234567890123456"
174+
password: "abcdefghijklmno"
122175
port: 27015
123176

124177
map_gen_settings:
@@ -196,7 +249,7 @@ map_gen_settings:
196249
- "x": 0
197250
"y": 0
198251
# Use null for a random seed, number for a specific seed.
199-
seed: null
252+
seed: null
200253

201254
map_settings:
202255
difficulty_settings:
@@ -221,9 +274,9 @@ map_settings:
221274
enemy_attack_pollution_consumption_modifier: 1
222275
enemy_evolution:
223276
enabled: true
224-
time_factor: 4.0e-06
277+
time_factor: 0.000004
225278
destroy_factor: 0.002
226-
pollution_factor: 9.0e-07
279+
pollution_factor: 0.0000009
227280
enemy_expansion:
228281
enabled: true
229282
min_base_spacing: 3
@@ -303,5 +356,17 @@ map_settings:
303356
- 2
304357
- 3
305358
- 4
359+
negative_path_cache_delay_interval: 20
306360
max_failed_behavior_count: 3
307-
361+
362+
admin_list:
363+
# - "john_doe"
364+
# - "jane_doe"
365+
366+
white_list:
367+
# - "john_doe"
368+
# - "jane_doe"
369+
370+
ban_list:
371+
# - "john_doe"
372+
# - "jane_doe"

0 commit comments

Comments
 (0)