{{- $secrets := .Values.secrets }} {{- if or (not $secrets.JWT_SECRET) (eq $secrets.JWT_SECRET "change_me") }} {{- fail "secrets.JWT_SECRET must be overridden and cannot be 'change_me'" }} {{- end }} {{- /* The bundled Mongo service ("checkmate-mongodb") lives in .Release.Namespace. App pods reach it by bare name, but the KEDA operator runs in its own namespace and a bare name is NXDOMAIN there, so worker autoscaling fails to query the backlog. Qualify the in-cluster host to its FQDN here so the one connection string resolves from every namespace. External/already-qualified hosts are not matched (the char after the host name is "." for an FQDN, which the pattern excludes). */}} {{- $mongoFqdn := printf "checkmate-mongodb.%s.svc.cluster.local" .Release.Namespace }} apiVersion: v1 kind: Secret metadata: name: checkmate-secrets type: Opaque stringData: {{- range $key, $value := $secrets }} {{- if eq $key "DB_CONNECTION_STRING" }} {{ $key }}: {{ regexReplaceAll "(//|@)checkmate-mongodb([:/,]|$)" $value (printf "${1}%s${2}" $mongoFqdn) | quote }} {{- else }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }}