From ba5ab53bdb94b991fb4948a78df3a22ace097d7b Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sat, 30 Oct 2021 21:14:00 -0400 Subject: [PATCH] Allow custom server versions Allow user to specify server version. Download on server init. --- helm/Chart.yaml | 4 ++-- helm/ix_values.yaml | 3 ++- helm/questions.yaml | 8 ++++++++ helm/templates/deploy.yaml | 18 ++++++++++++++++++ helm/values.yaml | 5 ++++- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 61a1a40..6e2f7cd 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -15,9 +15,9 @@ type: application # 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.2 +version: 1.1.0 # 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 # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 1.16.4 +appVersion: 1.0.0 diff --git a/helm/ix_values.yaml b/helm/ix_values.yaml index 0dd21fa..4648913 100644 --- a/helm/ix_values.yaml +++ b/helm/ix_values.yaml @@ -1 +1,2 @@ -image: ducoterra/minecraft:1.16.4 +image: ducoterra/minecraft:latest +server_version: "1.17.1" diff --git a/helm/questions.yaml b/helm/questions.yaml index 82aea13..0182ab7 100644 --- a/helm/questions.yaml +++ b/helm/questions.yaml @@ -4,6 +4,14 @@ groups: - name: "Storage" description: "Minecraft Server Storage" questions: + - variable: server_version + description: "Server Version" + label: "Version" + group: "Server Config" + schema: + type: string + default: "1.17.1" + required: false - variable: port description: "Listen Port" group: "Server Config" diff --git a/helm/templates/deploy.yaml b/helm/templates/deploy.yaml index a457614..e6a0c7e 100644 --- a/helm/templates/deploy.yaml +++ b/helm/templates/deploy.yaml @@ -13,9 +13,27 @@ spec: labels: app: {{ .Release.Name }} spec: + initContainers: + - name: get-version + image: {{ .Values.get_server.image }} + imagePullPolicy: Always + env: + - name: SERVER_VERSION + value: {{ .Values.server_version }} + volumeMounts: + - mountPath: /downloads + name: data + - name: download-server + image: {{ .Values.get_server.image }} + imagePullPolicy: Always + command: ["bash", "-c", "curl -o server.jar $(cat SERVER_VERSION)"] + volumeMounts: + - mountPath: /downloads + name: data containers: - name: {{ .Release.Name }} image: {{ .Values.image }} + imagePullPolicy: Always ports: - containerPort: 25565 volumeMounts: diff --git a/helm/values.yaml b/helm/values.yaml index ab1e939..01943f6 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1,4 +1,7 @@ -image: ducoterra/minecraft:1.16.4 +image: ducoterra/minecraft:latest +get_server: + image: ducoterra/get-minecraft:latest +server_version: "1.17.1" port: 20101 max_cpu: 4 max_ram: 4