From 459fa49ab1f495f8284ca2a783cd762faaabfddf Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:58:06 -0400 Subject: [PATCH] feat(eco) add Network.eco config to eco. (#12246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Configure Network.eco for eco. ⚒️ Fixes # **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/incubator/eco/Chart.yaml | 4 +- charts/incubator/eco/questions.yaml | 173 ++++++++++++++---- charts/incubator/eco/templates/_configmap.tpl | 12 ++ charts/incubator/eco/templates/common.yaml | 12 +- charts/incubator/eco/values.yaml | 61 ++++-- 5 files changed, 208 insertions(+), 54 deletions(-) create mode 100644 charts/incubator/eco/templates/_configmap.tpl diff --git a/charts/incubator/eco/Chart.yaml b/charts/incubator/eco/Chart.yaml index 0d5a5328c8c..2ee1adf0cf2 100644 --- a/charts/incubator/eco/Chart.yaml +++ b/charts/incubator/eco/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "latest" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 14.0.1 + version: 14.0.3 deprecated: false description: A custom SteamCMD chart that runs ECO. home: https://truecharts.org/charts/incubator/eco @@ -21,7 +21,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/eco - https://github.com/ich777/docker-steamcmd-server/tree/eco type: application -version: 3.0.0 +version: 3.1.0 annotations: truecharts.org/catagories: | - games diff --git a/charts/incubator/eco/questions.yaml b/charts/incubator/eco/questions.yaml index 56c9b637222..0f9f955ddf2 100644 --- a/charts/incubator/eco/questions.yaml +++ b/charts/incubator/eco/questions.yaml @@ -11,46 +11,143 @@ questions: # Include{podSpec} # Include{containerMain} - - variable: env - label: Image Environment - schema: - additional_attrs: true - type: dict - attrs: - - variable: USERNAME - label: "UserName" - description: "Your Steam username (optionally leave it blank)." - schema: - type: string - default: "" - - variable: PASSWRD - label: "Password" - description: "Your Steam password (optionally leave it blank)" - schema: - type: string - private: true - default: "" - - variable: GAME_ID - label: "Game ID" - description: "The ID of the container to download at start up." - schema: - type: string - default: "" - - variable: GAME_PARAMS - label: "Game Params" - description: "Enter your start up commands for the server." - schema: - type: string - default: "" - - variable: VALIDATE - label: "Validate" - description: "Set the Variable to true if you want to validate the installation otherwise leave it blank." - schema: - type: boolean - default: true - # Include{containerBasic} # Include{containerAdvanced} + + - variable: eco + group: App Configuration + label: Eco + schema: + additional_attrs: true + type: dict + attrs: + - variable: game + label: Game Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: id + label: Game Id + description: The ID of the container to download at start up. + schema: + type: string + required: true + default: "739590" + - variable: user + label: Steam User + description: Leave blank for anonymous login. + schema: + type: string + default: "" + - variable: password + label: Steam Password + description: Leave blank for anonymous login. + schema: + type: string + default: "" + - variable: validate + label: Validate + description: Validates the game data. + schema: + type: boolean + default: true + - variable: params + label: Game Params + schema: + type: list + default: [] + required: true + items: + - variable: param + label: Param + schema: + type: string + required: true + default: "" + - variable: network + label: Network Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: PublicServer + label: Public Server + description: Defines if other players can see server. + schema: + type: boolean + default: false + - variable: Playtime + label: Play time + schema: + type: string + default: "" + - variable: DiscordAddress + label: Discord Address + description: Invite link ID for a Discord server. + schema: + type: string + default: "" + - variable: Password + label: Password + description: Defines if a server's password. + schema: + type: string + default: "" + - variable: Description + label: Server Name + description: Defines the name of the server. + schema: + type: string + default: "Truecharts ECO Server" + - variable: DetailedDescription + label: Detailed Description + description: Defines the server's description. + schema: + type: string + default: "Vanilla ECO game" + - variable: ServerCategory + label: Server Category + description: Set the server Category. + schema: + type: string + default: "None" + enum: + - value: None + description: None + - value: Beginner + description: Beginner + - value: Established + description: Established + - value: BeginnerHard + description: BeginnerHard + - value: Strange + description: Strange + - variable: RemoteAddress + label: Remote Address + description: Public/external IP-address or domain and port number needed to reach the server. + schema: + type: string + default: "localhost:3000/" + - variable: WebServerUrl + label: Web Server Url + description: Public/external web sever URL. + schema: + type: string + default: "localhost:3001" + - variable: Rate + label: Rate + description: The network rate used to communicate between server and client. + schema: + type: int + default: 20 + - variable: MaxConnections + label: Max Connections + description: Maximum number of concurrent players (-1 no limits). + schema: + type: int + default: -1 + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} diff --git a/charts/incubator/eco/templates/_configmap.tpl b/charts/incubator/eco/templates/_configmap.tpl new file mode 100644 index 00000000000..5c2c82f7c95 --- /dev/null +++ b/charts/incubator/eco/templates/_configmap.tpl @@ -0,0 +1,12 @@ +{{/* Define the configmap */}} +{{- define "eco.configmaps" -}} + +{{- $network := .Values.eco.network -}} + +eco-network: + enabled: true + data: + Network.eco: | + {{ $network | toJson }} + +{{- end -}} diff --git a/charts/incubator/eco/templates/common.yaml b/charts/incubator/eco/templates/common.yaml index b51394e00a4..058b6334e77 100644 --- a/charts/incubator/eco/templates/common.yaml +++ b/charts/incubator/eco/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render configmaps for all pods */}} +{{- $configmaps := include "eco.configmaps" . | fromYaml -}} +{{- if $configmaps -}} + {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/incubator/eco/values.yaml b/charts/incubator/eco/values.yaml index 3a82f1202b6..e6f1f1f47f5 100644 --- a/charts/incubator/eco/values.yaml +++ b/charts/incubator/eco/values.yaml @@ -14,17 +14,41 @@ service: main: ports: main: - port: 3001 protocol: http - targetPort: 3001 + port: 3001 game: enabled: true ports: game: enabled: true - port: 3000 protocol: udp - targetPort: 3000 + port: 3000 + +eco: + game: + id: 739590 + user: "" + password: "" + validate: false + params: [] + network: + PublicServer: true + Playtime: "" + DiscordAddress: "" + Password: "" + # server name + Description: "Truecharts ECO Server" + # server description + DetailedDescription: "Vanilla ECO game" + ServerCategory: "None" + RemoteAddress: "localhost:3000/" + IPAddress: "Any" + GameServerPort: "{{ .Values.service.game.ports.game.port }}" + WebServerPort: "{{ .Values.service.main.ports.main.port }}" + WebServerUrl: "localhost:3001" + Rate: 20 + MaxConnections: -1 + UPnPEnabled: false workload: main: @@ -35,21 +59,22 @@ workload: liveness: path: "/" type: http - port: "{{ .Values.service.main.ports.main.targetPort }}" + port: "{{ .Values.service.main.ports.main.port }}" readiness: path: "/" type: http - port: "{{ .Values.service.main.ports.main.targetPort }}" + port: "{{ .Values.service.main.ports.main.port }}" startup: type: tcp - port: "{{ .Values.service.main.ports.main.targetPort }}" + port: "{{ .Values.service.main.ports.main.port }}" env: - USERNAME: "" - PASSWRD: "" - GAME_ID: "739590" - GAME_PARAMS: "" - VALIDATE: false - # DATA_PERM: "770" + STEAMCMD_DIR: "{{ .Values.persistence.steamcmd.mountPath }}" + SERVER_DIR: "{{ .Values.persistence.serverfiles.mountPath }}" + GAME_ID: "{{ .Values.eco.game.id }}" + USERNAME: "{{ .Values.eco.game.user }}" + PASSWRD: "{{ .Values.eco.game.password }}" + GAME_PARAMS: '{{ join " " .Values.eco.game.params }}' + VALIDATE: "{{ .Values.eco.game.validate }}" persistence: steamcmd: @@ -58,6 +83,16 @@ persistence: serverfiles: enabled: true mountPath: /serverdata/serverfiles + network-config: + enabled: true + type: configmap + objectName: eco-network + targetSelector: + main: + main: + mountPath: /serverdata/serverfiles/Configs/Network.eco + subPath: Network.eco + readOnly: true portal: open: