fix(terraria) code clean up + gui overhaul (#5948)

* fix(terraria) code clean up + gui overhaul

* Update charts/incubator/terraria-tshock/values.yaml

Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Signed-off-by: Xstar97 <Xstar97@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/templates/_secret.tpl

Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Signed-off-by: Xstar97 <Xstar97@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/templates/_secret.tpl

Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Signed-off-by: Xstar97 <Xstar97@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/values.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/templates/_secret.tpl

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* bug fixes

* fix

* fix

* Apply suggestions from code review

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/questions.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* add required to string variables

* Update charts/incubator/terraria-tshock/questions.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/questions.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

* Update charts/incubator/terraria-tshock/questions.yaml

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>

Signed-off-by: Xstar97 <Xstar97@users.noreply.github.com>
Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97 2023-01-04 03:23:31 -05:00 committed by GitHub
parent cd6661797f
commit 43cbe9bf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 216 additions and 49 deletions

View File

@ -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

View File

@ -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

View File

@ -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 -}}

View File

@ -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" . }}

View File

@ -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