diff --git a/charts/incubator/discordgsm/.helmignore b/charts/incubator/discordgsm/.helmignore new file mode 100644 index 00000000000..77ca5567b26 --- /dev/null +++ b/charts/incubator/discordgsm/.helmignore @@ -0,0 +1,30 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# OWNERS file for Kubernetes +OWNERS +# helm-docs templates +*.gotmpl +# docs folder +/docs +# icon +icon.png diff --git a/charts/incubator/discordgsm/Chart.yaml b/charts/incubator/discordgsm/Chart.yaml new file mode 100644 index 00000000000..d5aa950a274 --- /dev/null +++ b/charts/incubator/discordgsm/Chart.yaml @@ -0,0 +1,33 @@ +apiVersion: v2 +appVersion: "2.9.0" +dependencies: + - name: common + repository: https://library-charts.truecharts.org + version: 11.0.3 + - condition: postgresql.enabled + name: postgresql + repository: https://charts.truecharts.org/ + version: 11.0.4 +description: A discord bot that monitors your game server and tracks the live data of your game servers. +home: https://truecharts.org/docs/charts/incubator/discordgsm +icon: https://truecharts.org/img/hotlink-ok/chart-icons/discordgsm.png +keywords: + - discordgsm + - game-server + - monitor +kubeVersion: ">=1.16.0-0" +maintainers: + - email: info@truecharts.org + name: TrueCharts + url: https://truecharts.org +name: discordgsm +sources: + - https://github.com/truecharts/charts/tree/master/charts/incubator/discordgsm + - https://github.com/DiscordGSM/GameServerMonitor +version: 0.0.1 +annotations: + truecharts.org/catagories: | + - monitor + - discord + truecharts.org/SCALE-support: "true" + truecharts.org/grade: U diff --git a/charts/incubator/discordgsm/README.md b/charts/incubator/discordgsm/README.md new file mode 100644 index 00000000000..ed411bdafb6 --- /dev/null +++ b/charts/incubator/discordgsm/README.md @@ -0,0 +1 @@ +# discordgsm diff --git a/charts/incubator/discordgsm/docs/installation_notes.md b/charts/incubator/discordgsm/docs/installation_notes.md new file mode 100644 index 00000000000..efcb5f2dece --- /dev/null +++ b/charts/incubator/discordgsm/docs/installation_notes.md @@ -0,0 +1,12 @@ +# Installation Notes + +- Set `App Token` to your discord bot token. Here's a basic guide from [discordGSM](https://discordgsm.com/guide/how-to-get-a-discord-bot-token). +- Set `Whitelist Guilds` to the server guild Ids if adding multiple Ids separate with `;`. + +Add your discord bot if you haven't done so and run initial commands to get started with discordGSM. + +:::info + +Checkout discordGSM supported list of game servers [here](https://discordgsm.com/guide/supported-games). + +::: diff --git a/charts/incubator/discordgsm/icon.png b/charts/incubator/discordgsm/icon.png new file mode 100644 index 00000000000..2a40da3ff3d Binary files /dev/null and b/charts/incubator/discordgsm/icon.png differ diff --git a/charts/incubator/discordgsm/questions.yaml b/charts/incubator/discordgsm/questions.yaml new file mode 100644 index 00000000000..42d761d6473 --- /dev/null +++ b/charts/incubator/discordgsm/questions.yaml @@ -0,0 +1,187 @@ +# Include{groups} +portals: + open: +# Include{portalLink} +questions: +# Include{global} +# Include{controller} +# Include{replicas} +# Include{replica1} +# Include{controllerExpertExtraArgs} + - variable: gsm + group: App Configuration + label: Discord GSM Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: app_token + label: App Token + description: Discord Bot Token. + schema: + type: string + required: true + default: "" + - variable: whitelist_guilds + label: Whitelist Guilds + description: Discord Guild ID + schema: + type: list + required: true + default: [] + items: + - variable: whitelist_guild_entry + label: Whitelist Guild Entry + schema: + type: string + required: true + default: "" + - variable: app_activity_type + label: App Activity Type + description: Presence activity type override. + schema: + type: string + required: true + default: "3" + enum: + - value: "0" + description: Playing + - value: "2" + description: Listening + - value: "3" + description: Watching + - value: "5" + description: Playing + - variable: app_activity_name + label: App Activity Name + description: Presence activity name override. + schema: + type: string + default: "" + - variable: app_presence_advertise + label: App Presense Advertise + description: Enable advertisement feature on presence + schema: + type: boolean + default: false + - variable: task_query_server + label: Task Query Server + description: Query servers task scheduled time in seconds. + schema: + type: int + default: 60 + - variable: command_query_public + label: Command Query Public + description: Whether the /queryserver command should be available to all users. + schema: + type: boolean + default: false + - variable: command_query_cooldown + label: Command Query Cooldown + description: The /queryserver command cooldown in seconds. (Administrator will not be affected) + schema: + type: int + default: 5 + - variable: web_api_enable + label: Web API Enable + description: Enable Web API feature. + schema: + type: boolean + default: false +# Include{containerConfig} +# Include{serviceRoot} + - variable: main + label: Main Service + description: The Primary service on which the healthcheck runs, often the webUI + schema: + additional_attrs: true + type: dict + attrs: +# Include{serviceSelectorLoadBalancer} +# Include{serviceSelectorExtras} + - variable: main + 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 + schema: + type: int + default: 10589 + required: true +# Include{serviceExpertRoot} + default: false +# Include{serviceExpert} +# Include{serviceList} +# Include{persistenceRoot} + - variable: config + label: App Config Storage + description: Stores the Application Configuration. + schema: + additional_attrs: true + type: dict + attrs: +# Include{persistenceBasic} +# Include{persistenceList} +# Include{ingressRoot} + - variable: main + label: Main Ingress + schema: + additional_attrs: true + type: dict + attrs: +# Include{ingressDefault} +# Include{ingressTLS} +# Include{ingressTraefik} +# Include{ingressList} +# Include{security} +# Include{securityContextAdvancedRoot} + - variable: privileged + label: Privileged mode + schema: + type: boolean + default: false + - variable: readOnlyRootFilesystem + label: ReadOnly Root Filesystem + schema: + type: boolean + default: false + - variable: allowPrivilegeEscalation + label: Allow Privilege Escalation + schema: + type: boolean + default: false + - variable: runAsNonRoot + label: runAsNonRoot + schema: + type: boolean + default: false +# Include{podSecurityContextRoot} + - variable: runAsUser + 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 + schema: + type: int + default: 0 + - variable: fsGroup + label: fsGroup + description: The group that should own ALL storage. + schema: + type: int + default: 568 +# Include{podSecurityContextAdvanced} +# Include{resources} +# Include{advanced} +# Include{addons} +# Include{codeserver} +# Include{vpn} +# Include{documentation} diff --git a/charts/incubator/discordgsm/templates/_secret.tpl b/charts/incubator/discordgsm/templates/_secret.tpl new file mode 100644 index 00000000000..8a7da83b281 --- /dev/null +++ b/charts/incubator/discordgsm/templates/_secret.tpl @@ -0,0 +1,32 @@ +{{/* Define the secret */}} +{{- define "gsm.secret" -}} + +{{- $secretName := printf "%s-gsm-secret" (include "tc.common.names.fullname" .) }} + +--- + +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ $secretName }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} +stringData: + DATABASE_URL: {{ .Values.postgresql.url.complete | trimAll "\"" }} + DB_CONNECTION: {{ print "postgres" }} + APP_TOKEN: {{ .Values.gsm.app_token | quote }} + {{- with .Values.gsm.whitelist_guilds }} + WHITELIST_GUILDS: {{ join ";" . }} + {{- end }} + APP_ACTIVITY_TYPE: {{ .Values.gsm.app_activity_type | quote }} + {{- with .Values.gsm.app_activity_name }} + APP_ACTIVITY_NAME: {{ . | quote }} + {{- end }} + APP_PRESENCE_ADVERTISE: {{ .Values.gsm.app_presence_advertise | quote }} + POSTGRES_SSL_MODE: {{ .Values.gsm.postgres_ssl_mode | quote }} + TASK_QUERY_SERVER: {{ .Values.gsm.task_query_server | quote }} + COMMAND_QUERY_PUBLIC: {{ .Values.gsm.command_query_public | quote }} + COMMAND_QUERY_COOLDOWN: {{ .Values.gsm.command_query_cooldown | quote }} + WEB_API_ENABLE: {{ .Values.gsm.web_api_enable | quote }} +{{- end }} diff --git a/charts/incubator/discordgsm/templates/common.yaml b/charts/incubator/discordgsm/templates/common.yaml new file mode 100644 index 00000000000..082030e50e0 --- /dev/null +++ b/charts/incubator/discordgsm/templates/common.yaml @@ -0,0 +1,7 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.common.loader.init" . }} + +{{- include "gsm.secret" . -}} + +{{/* Render the templates */}} +{{ include "tc.common.loader.apply" . }} diff --git a/charts/incubator/discordgsm/values.yaml b/charts/incubator/discordgsm/values.yaml new file mode 100644 index 00000000000..f6384736935 --- /dev/null +++ b/charts/incubator/discordgsm/values.yaml @@ -0,0 +1,73 @@ +image: + repository: tccr.io/truecharts/game-server-monitor + pullPolicy: IfNotPresent + tag: 2.9.0@sha256:270daf32b89029ea12945698e6087f4b774ae8c01f6a2f14e23080ece30e85c2 + +securityContext: + runAsNonRoot: false + readOnlyRootFilesystem: false + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +command: + - /bin/sh + - -c + - | + gunicorn \ + --bind 0.0.0.0:{{ .Values.service.main.ports.main.port }} \ + --workers={{ .Values.gsm.workers }} \ + --worker-class=gthread app:app \ + --timeout {{ .Values.gsm.timeout }} & \ + python -u main.py + +gsm: + # Server Config + workers: 2 + timeout: 90 + # Bot Config + # Fake Token for CI + app_token: "" + whitelist_guilds: [] + app_activity_type: 3 + app_activity_name: "" + app_presence_advertise: false + task_query_server: 60 + command_query_public: false + command_query_cooldown: 5 + web_api_enable: false + postgres_ssl_mode: disable + +envFrom: + - secretRef: + name: '{{ include "tc.common.names.fullname" . }}-gsm-secret' + +service: + main: + ports: + main: + port: 10230 + protocol: HTTP + +probes: + liveness: + type: HTTP + readiness: + type: HTTP + startup: + type: HTTP + +persistence: + config: + enabled: true + mountPath: /app/data + +postgresql: + enabled: true + existingSecret: dbcreds + postgresqlDatabase: discord_gsm + postgresqlUsername: discord_gsm + +portal: + enabled: true