From ff3c1f3ad8b0f154dcc3bce94e6a8cf221b76190 Mon Sep 17 00:00:00 2001 From: Campbell Pool Date: Tue, 24 Mar 2026 13:12:24 -0700 Subject: [PATCH 1/2] fix(config): handle numeric, boolean, and falsy env var values Numeric and boolean values in environment.data (e.g., PORT: 8787, REDIS_TLS_ENABLED: false) fail b64enc in Secret mode and render as unquoted YAML in ConfigMap mode. Fixes: - Add toString before b64enc (Secret) and toString|quote (ConfigMap) - Change the if guard from `if $val` to `if not (kindIs "invalid" $val)` so that falsy values (false, 0, "") are properly encoded instead of being treated as empty --- charts/portkey-gateway/templates/gateway/config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/portkey-gateway/templates/gateway/config.yaml b/charts/portkey-gateway/templates/gateway/config.yaml index bef418a..600321d 100644 --- a/charts/portkey-gateway/templates/gateway/config.yaml +++ b/charts/portkey-gateway/templates/gateway/config.yaml @@ -6,11 +6,11 @@ metadata: name: {{ include "portkeyenterprise.fullname" . }} labels: {{- include "gateway.labels" . }} -data: +data: {{- range $key, $val := .Values.environment.data }} - {{ $key }}: {{- if $val }} {{ $val | b64enc }} {{- else }} "" {{- end }} + {{ $key }}: {{- if not (kindIs "invalid" $val) }} {{ $val | toString | b64enc }} {{- else }} "" {{- end }} {{- end -}} -{{- else -}} +{{- else -}} apiVersion: v1 kind: ConfigMap metadata: @@ -19,7 +19,7 @@ metadata: {{- include "gateway.labels" . }} data: {{- range $key, $val := .Values.environment.data }} - {{ $key }}: {{ $val }} + {{ $key }}: {{ $val | toString | quote }} {{- end -}} {{- end -}} {{- end -}} \ No newline at end of file From a1bd543c4cc0c66acbf3e739fc0256c590e1cbcc Mon Sep 17 00:00:00 2001 From: Campbell Pool Date: Wed, 25 Mar 2026 13:01:26 -0700 Subject: [PATCH 2/2] Update charts/portkey-gateway/templates/gateway/config.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- charts/portkey-gateway/templates/gateway/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/portkey-gateway/templates/gateway/config.yaml b/charts/portkey-gateway/templates/gateway/config.yaml index 600321d..586320c 100644 --- a/charts/portkey-gateway/templates/gateway/config.yaml +++ b/charts/portkey-gateway/templates/gateway/config.yaml @@ -19,7 +19,7 @@ metadata: {{- include "gateway.labels" . }} data: {{- range $key, $val := .Values.environment.data }} - {{ $key }}: {{ $val | toString | quote }} + {{ $key }}: {{- if not (kindIs "invalid" $val) }} {{ $val | toString | quote }} {{- else }} "" {{- end }} {{- end -}} {{- end -}} {{- end -}} \ No newline at end of file