From 3c7dc3dafb1746b9fb54a002f9d88ba3cda578ab Mon Sep 17 00:00:00 2001 From: Andrea Di Giorgi Date: Thu, 26 Sep 2024 22:14:44 -0700 Subject: [PATCH] fix: Populate SQL_CONNECT_ATTRIBUTES in admintools and schema job --- charts/temporal/templates/_admintools-env.yaml | 4 ++++ charts/temporal/templates/_helpers.tpl | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/charts/temporal/templates/_admintools-env.yaml b/charts/temporal/templates/_admintools-env.yaml index 307fba0f..7939d296 100644 --- a/charts/temporal/templates/_admintools-env.yaml +++ b/charts/temporal/templates/_admintools-env.yaml @@ -37,6 +37,10 @@ secretKeyRef: name: {{ include "temporal.persistence.secretName" (list $global $store) }} key: {{ include "temporal.persistence.secretKey" (list $global $store) }} + {{- with $driverConfig.connectAttributes }} +- name: SQL_CONNECT_ATTRIBUTES + value: {{ include "temporal.persistence.sql.connectAttributes" (list $global $store) | quote }} + {{- end }} {{- with $driverConfig.tls }} - name: SQL_TLS value: {{ .enabled | quote }} diff --git a/charts/temporal/templates/_helpers.tpl b/charts/temporal/templates/_helpers.tpl index 609ca6b0..00c717b7 100644 --- a/charts/temporal/templates/_helpers.tpl +++ b/charts/temporal/templates/_helpers.tpl @@ -337,6 +337,18 @@ Source: https://stackoverflow.com/a/52024583/3027614 {{- end -}} {{- end -}} +{{- define "temporal.persistence.sql.connectAttributes" -}} +{{- $global := index . 0 -}} +{{- $store := index . 1 -}} +{{- $storeConfig := index $global.Values.server.config.persistence $store -}} +{{- $driverConfig := $storeConfig.sql -}} +{{- $result := list -}} +{{- range $key, $value := $driverConfig.connectAttributes -}} + {{- $result = append $result (printf "%s=%s" $key $value) -}} +{{- end -}} +{{- join "&" $result -}} +{{- end -}} + {{- define "temporal.persistence.elasticsearch.secretName" -}} {{- $global := index . 0 -}} {{- $store := index . 1 -}}