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 apiVersion: v2
appVersion: "tshock" appVersion: "tshock"
dependencies: dependencies:
@ -9,8 +5,8 @@ dependencies:
repository: https://library-charts.truecharts.org repository: https://library-charts.truecharts.org
version: 11.1.2 version: 11.1.2
deprecated: false deprecated: false
description: "This Chart will download and install Terraria and the TShock MOD and run it. SERVER PASSWORD: Chart" description: SteamCMD Terraria and the TShock MOD.
home: https://truecharts.org/charts/incubator/terraria-tshock home: https://truecharts.org/charts/incubator/terraria-tshock.png
icon: https://truecharts.org/img/hotlink-ok/chart-icons/terraria-tshock.png icon: https://truecharts.org/img/hotlink-ok/chart-icons/terraria-tshock.png
keywords: keywords:
- terraria-tshock - terraria-tshock
@ -22,8 +18,13 @@ maintainers:
url: https://truecharts.org url: https://truecharts.org
name: terraria-tshock name: terraria-tshock
sources: 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://tshock.co/
- https://hub.docker.com/r/ich777/terrariaserver - https://hub.docker.com/r/ich777/terrariaserver
type: application 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{replicas}
# Include{replica1} # Include{replica1}
# Include{controllerExpertExtraArgs} # Include{controllerExpertExtraArgs}
- variable: env - variable: terraria
group: "App Configuration" group: App Configuration
label: "Image Environment" label: Terraria Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: GAME_PARAMS - variable: pass
label: "GAME_PARAMS" label: Server Pass
description: "Enter your start up commands for the server." description: Sets the server password.
schema: schema:
type: string 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{containerConfig}
# Include{serviceRoot} # Include{serviceRoot}
- variable: main - variable: main
label: "Main Service" label: Main Service
description: "The Primary service on which the healthcheck runs, often the webUI" description: The Primary service on which the healthcheck runs, often the webUI
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@ -33,21 +144,21 @@ questions:
# Include{serviceSelectorLoadBalancer} # Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras} # Include{serviceSelectorExtras}
- variable: main - variable: main
label: "Main Service Port Configuration" label: Main Service Port Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: port - variable: port
label: "Port" label: Port
description: "This port exposes the container port on the service" description: This port exposes the container port on the service
schema: schema:
type: int type: int
default: 9014 default: 9014
required: true required: true
- variable: tcp - variable: tcp
label: 'tcp service' label: tcp service
description: "Container Port 7777" description: Container Port 7777
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@ -55,14 +166,14 @@ questions:
# Include{serviceSelectorLoadBalancer} # Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras} # Include{serviceSelectorExtras}
- variable: tcp - variable: tcp
label: "tcp Service Port Configuration" label: tcp Service Port Configuration
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: port - variable: port
label: "Port" label: Port
description: "This port exposes the container port on the service" description: This port exposes the container port on the service
schema: schema:
type: int type: int
default: 7777 default: 7777
@ -73,8 +184,8 @@ questions:
# Include{serviceList} # Include{serviceList}
# Include{persistenceRoot} # Include{persistenceRoot}
- variable: serverfiles - variable: serverfiles
label: "serverfiles Storage" label: serverfiles Storage
description: "Container Path serverdataserverfiles" description: Container Path serverdataserverfiles
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@ -83,7 +194,7 @@ questions:
# Include{persistenceList} # Include{persistenceList}
# Include{ingressRoot} # Include{ingressRoot}
- variable: main - variable: main
label: "Main Ingress" label: Main Ingress
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
@ -95,41 +206,41 @@ questions:
# Include{security} # Include{security}
# Include{securityContextAdvancedRoot} # Include{securityContextAdvancedRoot}
- variable: privileged - variable: privileged
label: "Privileged mode" label: Privileged mode
schema: schema:
type: boolean type: boolean
default: false default: false
- variable: readOnlyRootFilesystem - variable: readOnlyRootFilesystem
label: "ReadOnly Root Filesystem" label: ReadOnly Root Filesystem
schema: schema:
type: boolean type: boolean
default: false default: false
- variable: allowPrivilegeEscalation - variable: allowPrivilegeEscalation
label: "Allow Privilege Escalation" label: Allow Privilege Escalation
schema: schema:
type: boolean type: boolean
default: false default: false
- variable: runAsNonRoot - variable: runAsNonRoot
label: "runAsNonRoot" label: runAsNonRoot
schema: schema:
type: boolean type: boolean
default: false default: false
# Include{podSecurityContextRoot} # Include{podSecurityContextRoot}
- variable: runAsUser - variable: runAsUser
label: "runAsUser" label: runAsUser
description: "The UserID of the user running the application" description: The UserID of the user running the application
schema: schema:
type: int type: int
default: 0 default: 0
- variable: runAsGroup - variable: runAsGroup
label: "runAsGroup" label: runAsGroup
description: The groupID this App of the user running the application" description: The groupID this App of the user running the application
schema: schema:
type: int type: int
default: 0 default: 0
- variable: fsGroup - variable: fsGroup
label: "fsGroup" label: fsGroup
description: "The group that should own ALL storage." description: The group that should own ALL storage.
schema: schema:
type: int type: int
default: 568 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 */}} {{/* 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: image:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
repository: tccr.io/truecharts/terraria-tshock repository: tccr.io/truecharts/terraria-tshock
tag: vtshock@sha256:93dc07c1fbae51e58d02c678aa005b9c2820993255f2f4e4bee3565ebd26f23d 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: persistence:
serverfiles: serverfiles:
enabled: true enabled: true
mountPath: /serverdata/serverfiles mountPath: /serverdata/serverfiles
podSecurityContext:
runAsGroup: 0 envFrom:
runAsUser: 0 - secretRef:
securityContext: name: '{{ include "tc.common.names.fullname" . }}-secret'
readOnlyRootFilesystem: false
runAsNonRoot: false
service: service:
main: main:
ports: ports:
@ -27,8 +46,6 @@ service:
tcp: tcp:
enabled: true enabled: true
port: 7777 port: 7777
protocol: TCP
targetPort: 7777
portal: portal:
enabled: true enabled: true