diff --git a/charts/incubator/terraria-tshock/Chart.yaml b/charts/incubator/terraria-tshock/Chart.yaml index 58a3736cf2e..fd4faa09635 100644 --- a/charts/incubator/terraria-tshock/Chart.yaml +++ b/charts/incubator/terraria-tshock/Chart.yaml @@ -1,7 +1,3 @@ -annotations: - truecharts.org/SCALE-support: "true" - truecharts.org/catagories: | - - GameServers apiVersion: v2 appVersion: "tshock" dependencies: @@ -9,8 +5,8 @@ dependencies: repository: https://library-charts.truecharts.org version: 11.1.2 deprecated: false -description: "This Chart will download and install Terraria and the TShock MOD and run it. SERVER PASSWORD: Chart" -home: https://truecharts.org/charts/incubator/terraria-tshock +description: SteamCMD Terraria and the TShock MOD. +home: https://truecharts.org/charts/incubator/terraria-tshock.png icon: https://truecharts.org/img/hotlink-ok/chart-icons/terraria-tshock.png keywords: - terraria-tshock @@ -22,8 +18,13 @@ maintainers: url: https://truecharts.org name: terraria-tshock sources: - - https://github.com/truecharts/charts/tree/master/charts/incubator/terraria-tshock + - https://github.com/truecharts/charts/tree/master/charts/incubator/terraria-tshock.png - https://tshock.co/ - https://hub.docker.com/r/ich777/terrariaserver type: application -version: 2.0.8 +version: 3.0.0 +annotations: + truecharts.org/catagories: | + - GameServers + truecharts.org/SCALE-support: "true" + truecharts.org/grade: U diff --git a/charts/incubator/terraria-tshock/questions.yaml b/charts/incubator/terraria-tshock/questions.yaml index 7a57f81c2bc..641efb415e9 100644 --- a/charts/incubator/terraria-tshock/questions.yaml +++ b/charts/incubator/terraria-tshock/questions.yaml @@ -8,24 +8,135 @@ questions: # Include{replicas} # Include{replica1} # Include{controllerExpertExtraArgs} - - variable: env - group: "App Configuration" - label: "Image Environment" + - variable: terraria + group: App Configuration + label: Terraria Configuration schema: additional_attrs: true type: dict attrs: - - variable: GAME_PARAMS - label: "GAME_PARAMS" - description: "Enter your start up commands for the server." + - variable: pass + label: Server Pass + description: Sets the server password. schema: type: string - default: "-config serverconfig.txt" + private: true + required: true + default: "" + - variable: autocreate + label: Auto Create + description: Creates a world if none is found. + schema: + type: string + default: "1" + required: true + enum: + - value: "1" + description: Small + - value: "2" + description: Medium + - value: "3" + description: Large + - variable: seed + label: World Seed + description: Specifies the world seed. + schema: + type: string + required: true + default: AwesomeSeed + - variable: worldname + label: Server World Name + description: Sets the name of the world + schema: + type: string + required: true + default: "" + - variable: motd + label: Server Message of The Day + description: Set the server motto of the day text. + schema: + type: string + required: true + default: "" + - variable: maxplayers + label: Max Players Count + description: Sets the max number of players. + schema: + type: int + default: 16 + required: true + min: 1 + max: 255 + - variable: lang + label: Language + description: Sets the server's language. + schema: + type: string + default: en-US + required: true + enum: + - value: en-US + description: English + - value: de-DE + description: German + - value: it-IT + description: Italian + - value: fr-FR + description: French + - value: es-ES + description: Spanish + - value: ru-RU + description: Russian + - value: zh-Hans + description: Chinese + - value: pt-BR + description: Portuguese + - value: pl-PL + description: Polish + - variable: easy_game_params + label: Easy Game Parameters + description: Appends the game extra params to the Game Extra Parameters list + schema: + additional_attrs: true + type: dict + attrs: + - variable: noupnp + label: no UPNP Flag + description: Disables automatic universal plug and play. + schema: + type: boolean + default: true + - variable: secure + label: Secure Flag + description: Adds additional cheat protection to the server. + schema: + type: boolean + default: false + - variable: steam + label: Steam Flag + description: Enables Steam support. + schema: + type: boolean + default: false + - variable: game_params + label: Game Parameters + description: Enter your game parameters starting with -, one per entry + schema: + type: list + default: [] + items: + - variable: game_params_entry + label: Parameter Entry + description: Single parameter per entry. Start with - + schema: + type: string + default: "" + required: true # Include{containerConfig} # Include{serviceRoot} - variable: main - label: "Main Service" - description: "The Primary service on which the healthcheck runs, often the webUI" + label: Main Service + description: The Primary service on which the healthcheck runs, often the webUI schema: additional_attrs: true type: dict @@ -33,21 +144,21 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: main - label: "Main Service Port Configuration" + label: Main Service Port Configuration schema: additional_attrs: true type: dict attrs: - variable: port - label: "Port" - description: "This port exposes the container port on the service" + label: Port + description: This port exposes the container port on the service schema: type: int default: 9014 required: true - variable: tcp - label: 'tcp service' - description: "Container Port 7777" + label: tcp service + description: Container Port 7777 schema: additional_attrs: true type: dict @@ -55,14 +166,14 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: tcp - label: "tcp Service Port Configuration" + label: tcp Service Port Configuration schema: additional_attrs: true type: dict attrs: - variable: port - label: "Port" - description: "This port exposes the container port on the service" + label: Port + description: This port exposes the container port on the service schema: type: int default: 7777 @@ -73,8 +184,8 @@ questions: # Include{serviceList} # Include{persistenceRoot} - variable: serverfiles - label: "serverfiles Storage" - description: "Container Path serverdataserverfiles" + label: serverfiles Storage + description: Container Path serverdataserverfiles schema: additional_attrs: true type: dict @@ -83,7 +194,7 @@ questions: # Include{persistenceList} # Include{ingressRoot} - variable: main - label: "Main Ingress" + label: Main Ingress schema: additional_attrs: true type: dict @@ -95,41 +206,41 @@ questions: # Include{security} # Include{securityContextAdvancedRoot} - variable: privileged - label: "Privileged mode" + label: Privileged mode schema: type: boolean default: false - variable: readOnlyRootFilesystem - label: "ReadOnly Root Filesystem" + label: ReadOnly Root Filesystem schema: type: boolean default: false - variable: allowPrivilegeEscalation - label: "Allow Privilege Escalation" + label: Allow Privilege Escalation schema: type: boolean default: false - variable: runAsNonRoot - label: "runAsNonRoot" + label: runAsNonRoot schema: type: boolean default: false # Include{podSecurityContextRoot} - variable: runAsUser - label: "runAsUser" - description: "The UserID of the user running the application" + label: runAsUser + description: The UserID of the user running the application schema: type: int default: 0 - variable: runAsGroup - label: "runAsGroup" - description: The groupID this App of the user running the application" + label: runAsGroup + description: The groupID this App of the user running the application schema: type: int default: 0 - variable: fsGroup - label: "fsGroup" - description: "The group that should own ALL storage." + label: fsGroup + description: The group that should own ALL storage. schema: type: int default: 568 diff --git a/charts/incubator/terraria-tshock/templates/_secret.tpl b/charts/incubator/terraria-tshock/templates/_secret.tpl new file mode 100644 index 00000000000..3866f8a6c0d --- /dev/null +++ b/charts/incubator/terraria-tshock/templates/_secret.tpl @@ -0,0 +1,32 @@ +{{/* Define the secret */}} +{{- define "terraria.secret" -}} + +{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) }} + +{{- $params := list }} +{{- $params = mustAppend $params (printf "-port %v" .Values.service.main.ports.main.port) -}} +{{- $params = mustAppend $params (printf "-password %v" .Values.terraria.pass) -}} +{{- $params = mustAppend $params (printf "-autocreate %v" .Values.terraria.autocreate) -}} +{{- $params = mustAppend $params (printf "-seed %v" .Values.terraria.seed) -}} +{{- $params = mustAppend $params (printf "-worldname %v" .Values.terraria.worldname) -}} +{{- $params = mustAppend $params (printf "-motd %v" .Values.terraria.motd) -}} +{{- $params = mustAppend $params (printf "-maxplayers %v" .Values.terraria.maxplayers) -}} +{{- $params = mustAppend $params (printf "-lang %v" .Values.terraria.lang) -}} + +{{- range $key, $value := .Values.terraria.easy_game_params -}} + {{- if $value -}} + {{- $params = mustAppend $params (printf "-%s" $key) -}} + {{- end -}} +{{- end -}} + +{{- $params = mustAppend $params .Values.terraria.game_params }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} +stringData: + GAME_PARAMS: {{ join " " $params | quote }} +{{- end -}} diff --git a/charts/incubator/terraria-tshock/templates/common.yaml b/charts/incubator/terraria-tshock/templates/common.yaml index cbf66c20818..82916dcf937 100644 --- a/charts/incubator/terraria-tshock/templates/common.yaml +++ b/charts/incubator/terraria-tshock/templates/common.yaml @@ -1,2 +1,8 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.common.loader.init" . }} + +{{/* Render secret */}} +{{- include "terraria.secret" . }} + {{/* Render the templates */}} -{{ include "tc.common.loader.all" . }} +{{ include "tc.common.loader.apply" . }} diff --git a/charts/incubator/terraria-tshock/values.yaml b/charts/incubator/terraria-tshock/values.yaml index 76c39474cd4..97d41be3b73 100644 --- a/charts/incubator/terraria-tshock/values.yaml +++ b/charts/incubator/terraria-tshock/values.yaml @@ -1,19 +1,38 @@ -env: - GAME_PARAMS: -config serverconfig.txt image: pullPolicy: IfNotPresent repository: tccr.io/truecharts/terraria-tshock tag: vtshock@sha256:93dc07c1fbae51e58d02c678aa005b9c2820993255f2f4e4bee3565ebd26f23d + +terraria: + pass: secretpass + autocreate: "1" + seed: AwesomeSeed + worldname: scale terraria + maxplayers: 16 + lang: en-US + easy_game_params: + noupnp: true + steam: false + secure: false + game_params: [] + +podSecurityContext: + runAsGroup: 0 + runAsUser: 0 + +securityContext: + readOnlyRootFilesystem: false + runAsNonRoot: false + persistence: serverfiles: enabled: true mountPath: /serverdata/serverfiles -podSecurityContext: - runAsGroup: 0 - runAsUser: 0 -securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false + +envFrom: + - secretRef: + name: '{{ include "tc.common.names.fullname" . }}-secret' + service: main: ports: @@ -27,8 +46,6 @@ service: tcp: enabled: true port: 7777 - protocol: TCP - targetPort: 7777 portal: enabled: true