diff --git a/README.md b/README.md index 35a68dd..eacf84c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ The following table lists the configurable parameters of the `factorio-server-ch | factorioServer.generate_new_save | Generate a New Save | `true` | | factorioServer.update_mods_on_start | Update mods on start | `false` | | factorioServer.load_latest_save | lets the game know if you want to load the latest save | `true` | -| factorioServer.config_path | Location of the configuration files that are generated | `/srv` | | serverSettings.name | Your Instance Name | `Factorio` | | serverSettings.description | Your Instance Description | `"Factorio running on Kubernetes"` | | serverSettings.max_players | Maximum number of players allowed, admins can join even a full server. 0 means unlimited. | `0` | diff --git a/charts/factorio-server-charts/Chart.yaml b/charts/factorio-server-charts/Chart.yaml index 6bd761a..6a86e24 100644 --- a/charts/factorio-server-charts/Chart.yaml +++ b/charts/factorio-server-charts/Chart.yaml @@ -20,7 +20,7 @@ sources: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.9 +version: 1.0.10 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/factorio-server-charts/README.md b/charts/factorio-server-charts/README.md index e1ddb99..501d6fb 100644 --- a/charts/factorio-server-charts/README.md +++ b/charts/factorio-server-charts/README.md @@ -67,7 +67,6 @@ The following table lists the configurable parameters of the `factorio-server-ch | factorioServer.generate_new_save | Generate a New Save | `true` | | factorioServer.update_mods_on_start | Update mods on start | `false` | | factorioServer.load_latest_save | lets the game know if you want to load the latest save | `true` | -| factorioServer.config_path | Location of the configuration files that are generated | `/srv` | | serverSettings.name | Your Instance Name | `Factorio` | | serverSettings.description | Your Instance Description | `"Factorio running on Kubernetes"` | | serverSettings.max_players | Maximum number of players allowed, admins can join even a full server. 0 means unlimited. | `0` | diff --git a/charts/factorio-server-charts/templates/deployment.yaml b/charts/factorio-server-charts/templates/deployment.yaml index 00b7aa2..1511282 100644 --- a/charts/factorio-server-charts/templates/deployment.yaml +++ b/charts/factorio-server-charts/templates/deployment.yaml @@ -19,17 +19,34 @@ spec: labels: app: {{ template "factorio-server-charts.fullname" . }} spec: - securityContext: - runAsUser: 845 - runAsGroup: 845 - fsGroup: 845 + initContainers: + - name: volume-permissions-serversettingsconfig + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - /bin/bash + - -ec + - | + mkdir -p /factorio/configs + mkdir -p /factorio/config + cp --verbose /deployed-configs/* /factorio/configs + #sleep 100 + chown -vR factorio:factorio /factorio + chmod -vR 777 /factorio/configs + ls -alth /factorio + securityContext: + runAsUser: 0 + volumeMounts: + - name: datadir + mountPath: /factorio + - name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig + mountPath: /deployed-configs containers: - name: {{ template "factorio-server-charts.fullname" . }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: runAsUser: 0 - allowPrivilegeEscalation: true ports: - name: factorio containerPort: {{ .Values.service.port }} @@ -41,8 +58,6 @@ spec: volumeMounts: - name: datadir mountPath: /factorio - - name: {{ template "factorio-server-charts.fullname" . }}-serversettingsconfig - mountPath: {{ .Values.factorioServer.config_path | quote }} env: - name: UPDATE_MODS_ON_START value: {{ .Values.factorioServer.update_mods_on_start | quote }} @@ -59,7 +74,7 @@ spec: - name: PORT value: {{ .Values.service.port | quote }} - name: CONFIG - value: {{ .Values.factorioServer.config_path | quote }} + value: /factorio/configs {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/factorio-server-charts/values.yaml b/charts/factorio-server-charts/values.yaml index c61627c..e7291e5 100644 --- a/charts/factorio-server-charts/values.yaml +++ b/charts/factorio-server-charts/values.yaml @@ -1,6 +1,5 @@ #### K8s configuration #### - ## Number of replicas to create (only 1 is supported) replicaCount: 1 @@ -13,10 +12,7 @@ image: ## You should set an fix version, i.e.: # tag: "1.1.37" -# Security options the operator container should run with -securityContext: - runAsUser: 1000 - fsGroup: 2000 + ## The service is a kind tricky, so factorio uses UDP, but not every cloud provider is able to route UDP traffic. ## I.e. your cloud provider has LoadBalancers without the ability for UPD protocoll. Furthermore kubectl ist not able to route UDP Traffic @@ -24,7 +20,7 @@ securityContext: ## 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. ## 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! service: - type: ClusterIP + type: LoadBalancer port: 34197 ## If you are able in your cluster to map an external IP, set it here # externalIPs: @@ -81,7 +77,7 @@ affinity: {} ## Sets the data persistence volume configuration ## IMPORTANT: If you do not setup a PV all your savegames will be lost on pod recreation or helm upgrade persistence: - enabled: false + enabled: true dataDir: Size: "1Gi" ## If you have an existing claim, set your name here @@ -104,8 +100,7 @@ factorioServer: update_mods_on_start: false # lets the game know if you want to load the latest save load_latest_save: true - # Location of the configuration files that are generated - config_path: /srv + server_settings: # Your Instance Name