From ceb3930d6d3ac733de3b4b2d884f4aade132fa83 Mon Sep 17 00:00:00 2001 From: Whiskey24 Date: Thu, 22 Dec 2022 00:05:19 +0100 Subject: [PATCH] fix(ark): Replace params with better UI/UX (#5278) * Remove targetport, update questions Remove targetport so that value is set to the prrovided value for port. Update questions with info to change the port numbers for multiple servers. * some changes * typo * Update charts/incubator/arksurvivalevolved/Chart.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/arksurvivalevolved/values.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * fixe * Update charts/incubator/arksurvivalevolved/Chart.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * bump * add error message when port is not +1 * Update charts/incubator/arksurvivalevolved/templates/common.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * fix secretname * fix name * Easier params * add another check * Fix typo Fixed typo in label for UDP Steam Service Signed-off-by: Whiskey24 * bump common * Update charts/incubator/arksurvivalevolved/templates/common.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Signed-off-by: Whiskey24 Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- .../incubator/arksurvivalevolved/Chart.yaml | 2 +- .../arksurvivalevolved/questions.yaml | 170 ++++++++++-------- .../arksurvivalevolved/templates/_secret.tpl | 41 +++++ .../arksurvivalevolved/templates/common.yaml | 16 +- .../incubator/arksurvivalevolved/values.yaml | 41 +++-- 5 files changed, 171 insertions(+), 99 deletions(-) create mode 100644 charts/incubator/arksurvivalevolved/templates/_secret.tpl diff --git a/charts/incubator/arksurvivalevolved/Chart.yaml b/charts/incubator/arksurvivalevolved/Chart.yaml index 3d067572099..b5408c511e1 100644 --- a/charts/incubator/arksurvivalevolved/Chart.yaml +++ b/charts/incubator/arksurvivalevolved/Chart.yaml @@ -26,4 +26,4 @@ sources: - https://survivetheark.com/ - https://hub.docker.com/r/ich777/steamcmd/ type: application -version: 2.0.4 +version: 3.0.0 diff --git a/charts/incubator/arksurvivalevolved/questions.yaml b/charts/incubator/arksurvivalevolved/questions.yaml index 14e0405770e..729da5265ca 100644 --- a/charts/incubator/arksurvivalevolved/questions.yaml +++ b/charts/incubator/arksurvivalevolved/questions.yaml @@ -8,88 +8,102 @@ questions: # Include{replicas} # Include{replica1} # Include{controllerExpertExtraArgs} - - variable: secretEnv - group: "App Configuration" - label: "Image Secrets" + - variable: ark + group: App Configuration + label: Ark Configuration schema: additional_attrs: true type: dict attrs: - - variable: USERNAME - label: "USERNAME" - description: "Your Steam username goes here if you want to install a game that needs a valid account, otherwise leave it blank (ATTENTION You have to disable Steam Guard)." + - variable: username + label: Username + description: Your Steam username goes here if you want to install a game that needs a valid account, otherwise leave it blank (ATTENTION You have to disable Steam Guard). schema: type: string default: "" - - variable: PASSWRD - label: "PASSWRD" - description: "Your Steam password goes here if you want to install a game that needs a valid account, otherwise leave it blank (ATTENTION You have to disable Steam Guard)." + - variable: password + label: Password + description: Your Steam password goes here if you want to install a game that needs a valid account, otherwise leave it blank (ATTENTION You have to disable Steam Guard). schema: type: string private: true default: "" - - variable: SRV_PWD - label: "SRV_PWD" - description: "Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces)" + - variable: srv_password + label: Server Password + description: Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces) schema: type: string private: true default: "" - - variable: SRV_ADMIN_PWD - label: "SRV_ADMIN_PWD" - description: "Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces)" + - variable: srv_admin_pass + label: Server Admin Password + description: Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces) schema: type: string private: true default: "" - - variable: env - group: "App Configuration" - label: "Image Environment" - schema: - additional_attrs: true - type: dict - attrs: - - variable: GAME_ID - label: "GAME_ID" + - variable: game_id + label: Game ID description: "The GAME_ID that the container download at startup.(https://developer.valvesoftware.com/wiki/Dedicated_Servers_List)" schema: type: string default: "376030" - - variable: MAP - label: "MAP" - description: "Map name" + - variable: map + label: Map + description: Map Name schema: type: string - default: "TheIsland" - - variable: SERVER_NAME - label: "SERVER_NAME" - description: "Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces)" + default: TheIsland + - variable: server_name + label: Server Name + description: Leave empty if you want to use the settings from GameUserSettings.ini (this field accepts no spaces) schema: type: string default: "" - - variable: VALIDATE - label: "VALIDATE" + - variable: validate + label: Valitdate description: "Set the Variable to true if you want to validate the installation otherwise leave it blank." schema: type: boolean default: true - - variable: GAME_PARAMS - label: "GAME_PARAMS" - description: "Enter your game parameters separated with ? and start with ? (don't put spaces in between eg: ?MaxPlayers=40?FastDecayUnsnappedCoreStructures=true)" + - variable: rcon_enabled + label: Enable RCON schema: - type: string - default: "?RCONPort=27020?RCONEnabled=True" - - variable: GAME_PARAMS_EXTRA - label: "GAME_PARAMS_EXTRA" - description: "Values to start the server" + type: boolean + default: true + - variable: game_params + label: Game Parameters + description: "Enter your game parameters starting with ? (don't put spaces in between eg: ?MaxPlayers=40?FastDecayUnsnappedCoreStructures=true). For multiple servers, change the port numbers in Networking and Services section ONLY." schema: - type: string - default: "-server -log -crossplay" + type: list + default: [] + items: + - variable: game_params_entry + label: Parameter Entry + description: Single parameter per entry. Start with ? + schema: + type: string + default: "" + required: true + - variable: game_params_extra + label: Game Extra Parameters + description: "Values to start the server, one per entry" + schema: + type: list + default: ["-server", "-log", "-crossplay"] + items: + - variable: game_params_extra_entry + label: Extra Parameter Entry + description: Single parameter per entry. + 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 @@ -97,21 +111,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: 7777 required: true - variable: udp2 - label: "udp2 service" - description: "Container Port 7778" + label: udp2 service + description: This should always be (Main Port + 1) schema: additional_attrs: true type: dict @@ -119,21 +133,21 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: udp2 - label: "udp2 Service Port Configuration" + label: udp2 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: 7778 required: true - variable: udpsteam - label: "udpsteam service" - description: "Container Port 27015" + label: UDP Steam Service + description: Container Port 27015 schema: additional_attrs: true type: dict @@ -141,21 +155,21 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: udpsteam - label: "udpsteam Service Port Configuration" + label: UDP Steam 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: 27015 required: true - variable: rcontcp - label: "rcontcp service" - description: "Container Port 27020" + label: rcontcp service + description: Container Port 27020 schema: additional_attrs: true type: dict @@ -163,14 +177,14 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: rcontcp - label: "rcontcp Service Port Configuration" + label: rcontcp 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: 27020 @@ -181,16 +195,16 @@ questions: # Include{serviceList} # Include{persistenceRoot} - variable: steamcmd - label: "steamcmd Storage" - description: "Container Path serverdatasteamcmd" + label: steamcmd Storage + description: Container Path serverdatasteamcmd schema: additional_attrs: true type: dict attrs: # Include{persistenceBasic} - variable: serverfiles - label: "serverfiles Storage" - description: "Container Path serverdataserverfiles" + label: serverfiles Storage + description: Container Path serverdataserverfiles schema: additional_attrs: true type: dict @@ -199,7 +213,7 @@ questions: # Include{persistenceList} # Include{ingressRoot} - variable: main - label: "Main Ingress" + label: Main Ingress schema: additional_attrs: true type: dict @@ -211,41 +225,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/arksurvivalevolved/templates/_secret.tpl b/charts/incubator/arksurvivalevolved/templates/_secret.tpl new file mode 100644 index 00000000000..bc7f26fc55d --- /dev/null +++ b/charts/incubator/arksurvivalevolved/templates/_secret.tpl @@ -0,0 +1,41 @@ +{{/* Define the secret */}} +{{- define "ark.secret" -}} + +{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) }} + +{{- $params := list }} +{{- $params = append $params (printf "?Port=%s" .Values.service.main.ports.main.port) -}} +{{- $params = append $params (printf "?QueryPort=%s" .Values.service.udpsteam.ports.udpsteam.port) -}} +{{- $params = append $params (printf "?RCONPort=%s" .Values.service.rcontcp.ports.rcontcp.port) -}} +{{- if .Values.ark.rcon_enabled -}} + {{- $params = append $params (print "?RCONEnabled=True") -}} +{{- end }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} +stringData: + GAME_ID: {{ .Values.ark.game_id | quote }} + GAME_PARAMS: {{ printf "%s%s" (join "" $params) (join "" .Values.ark.game_params) | quote }} + GAME_PARAMS_EXTRA: {{ (join " " .Values.ark.game_params_extra) | quote }} + MAP: {{ .Values.ark.map | quote }} + {{- with .Values.ark.server_name }} + SERVER_NAME: {{ . | quote }} + {{- end }} + VALIDATE: {{ default false .Values.ark.validate | quote }} + {{- with .Values.ark.srv_admin_password }} + SRV_ADMIN_PWD: {{ . | quote }} + {{- end }} + {{- with .Values.ark.srv_password }} + SRV_PWD: {{ . | quote }} + {{- end }} + {{- with .Values.ark.username }} + USERNAME: {{ . | quote }} + {{- end }} + {{- with .Values.ark.password }} + PASSWRD: {{ . | quote }} + {{- end }} +{{- end -}} diff --git a/charts/incubator/arksurvivalevolved/templates/common.yaml b/charts/incubator/arksurvivalevolved/templates/common.yaml index cbf66c20818..0de43afa177 100644 --- a/charts/incubator/arksurvivalevolved/templates/common.yaml +++ b/charts/incubator/arksurvivalevolved/templates/common.yaml @@ -1,2 +1,16 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.common.loader.init" . }} + +{{- if ne (int .Values.service.udp2.ports.udp2.port) (add1 (int .Values.service.main.ports.main.port)) -}} + {{- fail (printf "In the service udp2, the port for udp2 must be greater by 1 than the main service's port. You have to set it to <%s>." (add1 .Values.service.main.ports.main.port)) }} +{{- end -}} + +{{- if and (ge (int .Values.service.udpsteam.ports.udpsteam.port) 27020) (le (int .Values.service.udpsteam.ports.udpsteam.port) 27050) -}} + {{- fail "UDP Steam Service port cannot be between 27020 and 27050." -}} +{{- end }} + +{{/* Render secret */}} +{{- include "ark.secret" . }} + {{/* Render the templates */}} -{{ include "tc.common.loader.all" . }} +{{ include "tc.common.loader.apply" . }} diff --git a/charts/incubator/arksurvivalevolved/values.yaml b/charts/incubator/arksurvivalevolved/values.yaml index 5865bc01b05..0ec69306756 100644 --- a/charts/incubator/arksurvivalevolved/values.yaml +++ b/charts/incubator/arksurvivalevolved/values.yaml @@ -11,27 +11,33 @@ securityContext: readOnlyRootFilesystem: false runAsNonRoot: false -secretEnv: - SRV_ADMIN_PWD: "" - SRV_PWD: "" - USERNAME: "" - PASSWRD: "" +ark: + srv_admin_pass: "" + srv_password: "" + username: "" + password: "" + game_id: "376030" + rcon_enabled: true + game_params: [] + game_params_extra: + - -server + - -log + - -crossplay" + map: TheIsland + server_name: "" + validate: false -env: - GAME_ID: "376030" - GAME_PARAMS: "?RCONPort=27020?RCONEnabled=True" - GAME_PARAMS_EXTRA: -server -log -crossplay - MAP: TheIsland - SERVER_NAME: "" - VALIDATE: false +envFrom: + - secretRef: + name: '{{ include "tc.common.names.fullname" . }}-secret' probes: liveness: - port: "{{ .Values.service.rcontcp.ports.rcontcp.targetPort }}" + port: "{{ .Values.service.rcontcp.ports.rcontcp.port }}" readiness: - port: "{{ .Values.service.rcontcp.ports.rcontcp.targetPort }}" + port: "{{ .Values.service.rcontcp.ports.rcontcp.port }}" startup: - port: "{{ .Values.service.rcontcp.ports.rcontcp.targetPort }}" + port: "{{ .Values.service.rcontcp.ports.rcontcp.port }}" service: main: @@ -39,15 +45,14 @@ service: main: port: 7777 protocol: UDP - targetPort: 7777 udp2: enabled: true ports: udp2: enabled: true + # This should always be main +1 port: 7778 protocol: UDP - targetPort: 7778 udpsteam: enabled: true ports: @@ -55,7 +60,6 @@ service: enabled: true port: 27015 protocol: UDP - targetPort: 27015 rcontcp: enabled: true ports: @@ -63,7 +67,6 @@ service: enabled: true port: 27020 protocol: TCP - targetPort: 27020 persistence: serverfiles: