Skip to content

Commit 8423273

Browse files
committed
mc-router: Test for kindOf value for bool, resorb envBoolMap
1 parent a06a294 commit 8423273

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

charts/mc-router/templates/_helpers.tpl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,7 @@ Create the name of the service account to use
6565
Helper function for environment variables
6666
*/}}
6767
{{- define "mc-router.envMap" -}}
68-
{{- if index . 1 }}
69-
- name: {{ index . 0 }}
70-
value: {{ index . 1 | quote }}
71-
{{- end }}
72-
{{- end }}
73-
74-
{{/*
75-
Helper function for boolean environment variables
76-
*/}}
77-
{{- define "mc-router.envBoolMap" -}}
78-
{{- if ne (toString (index . 1)) "default" }}
68+
{{- if or (index . 1) (kindIs "bool" (index . 1)) }}
7969
- name: {{ index . 0 }}
8070
value: {{ index . 1 | quote }}
8171
{{- end }}

charts/mc-router/templates/deployment.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ spec:
4949
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
5050
imagePullPolicy: {{ .Values.image.pullPolicy }}
5151
env:
52-
{{- include "mc-router.envBoolMap" (list "IN_KUBE_CLUSTER" "true") }}
52+
{{- include "mc-router.envMap" (list "IN_KUBE_CLUSTER" "true") }}
5353
{{- include "mc-router.envMap" (list "API_BINDING" (printf ":%d" $apiPort)) }}
5454
{{- include "mc-router.envMap" (list "PORT" $minecraftPort) }}
5555

5656
{{- with .Values.minecraftRouter }}
57-
{{- include "mc-router.envBoolMap" (list "AUTO_SCALE_UP" .autoScaleUp.enabled) }}
57+
{{- include "mc-router.envMap" (list "AUTO_SCALE_UP" .autoScaleUp.enabled) }}
5858
{{- include "mc-router.envMap" (list "CONNECTION_RATE_LIMIT" .connectionRateLimit) }}
5959
{{- include "mc-router.envMap" (list "CPU_PROFILE" .cpuProfilePath) }}
60-
{{- include "mc-router.envBoolMap" (list "DEBUG" .debug.enabled) }}
60+
{{- include "mc-router.envMap" (list "DEBUG" .debug.enabled) }}
6161

6262
{{- with .defaultServer }}
6363
{{- include "mc-router.envMap" (list "DEFAULT" (printf "%s:%d" .host (.port | int))) }}
@@ -84,9 +84,9 @@ spec:
8484
{{- end }}
8585

8686
{{- include "mc-router.envSecretMap" (list "NGROK_TOKEN" .ngrokToken.existingSecret .ngrokToken.tokenKey ) }}
87-
{{- include "mc-router.envBoolMap" (list "SIMPLIFY_SRV" .simplifySrv) }}
88-
{{- include "mc-router.envBoolMap" (list "USE_PROXY_PROTOCOL" .useProxyProtocol) }}
89-
{{- include "mc-router.envBoolMap" (list "VERSION" .showVersion) }}
87+
{{- include "mc-router.envMap" (list "SIMPLIFY_SRV" .simplifySrv) }}
88+
{{- include "mc-router.envMap" (list "USE_PROXY_PROTOCOL" .useProxyProtocol) }}
89+
{{- include "mc-router.envMap" (list "VERSION" .showVersion) }}
9090
{{- end }}
9191

9292
{{- range $key, $value := .Values.extraEnv }}

0 commit comments

Comments
 (0)