From eeac284f3e09f2fdad16524ec26ddede39a81c86 Mon Sep 17 00:00:00 2001 From: Sinto Sajeev Date: Thu, 7 Nov 2024 05:27:30 -0800 Subject: [PATCH] Updated ENV variables and database configurations in Forms-flow-analytics --- .../templates/_helpers.tpl | 19 ++++++++++++++++++- .../templates/secrets.yaml | 1 + charts/forms-flow-analytics/values.yaml | 9 +++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/charts/forms-flow-analytics/templates/_helpers.tpl b/charts/forms-flow-analytics/templates/_helpers.tpl index ad619a91..ca9020fd 100644 --- a/charts/forms-flow-analytics/templates/_helpers.tpl +++ b/charts/forms-flow-analytics/templates/_helpers.tpl @@ -50,7 +50,11 @@ Create a default fully qualified scheduler name. Create a default fully qualified postgresql name. */}} {{- define "redash.postgresql.fullname" -}} -{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- if .Values.postgresql.enabled -}} + {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- else -}} + {{- printf "%s" .Values.postgresql.fullnameOverride -}} +{{- end -}} {{- end -}} {{/* @@ -84,6 +88,19 @@ Shared environment block used across each component. {{- else }} value: {{ default "" .Values.externalPostgreSQL | quote }} {{- end }} +- name: REDASH_DATABASE_USER + value: {{ .Values.postgresql.auth.username | quote }} +- name: REDASH_DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Release.Name }} + key: redashDatabasePassword +- name: REDASH_DATABASE_HOSTNAME + value: {{ include "redash.postgresql.fullname" . }} +- name: REDASH_DATABASE_PORT + value: {{ .Values.postgresql.primary.service.ports.postgresql | quote }} +- name: REDASH_DATABASE_NAME + value: {{ .Values.postgresql.auth.database | quote }} {{- end }} {{- else -}} - name: REDASH_DATABASE_USER diff --git a/charts/forms-flow-analytics/templates/secrets.yaml b/charts/forms-flow-analytics/templates/secrets.yaml index b1da2064..f7c3d14a 100644 --- a/charts/forms-flow-analytics/templates/secrets.yaml +++ b/charts/forms-flow-analytics/templates/secrets.yaml @@ -15,5 +15,6 @@ data: {{- $null := required "A value for one of the following variables is required: redash.cookieSecret (secure random value), redash.existingSecret (secret name)" (or .Values.redash.cookieSecret .Values.redash.existingSecret) }} cookieSecret: {{ default "" .Values.redash.cookieSecret | b64enc | quote }} mailPassword: {{ default "" .Values.redash.mailPassword | b64enc | quote }} + redashDatabasePassword: {{ default "" .Values.postgresql.auth.password | b64enc | quote }} ## End primary Redash configuration {{- end -}} diff --git a/charts/forms-flow-analytics/values.yaml b/charts/forms-flow-analytics/values.yaml index b15027ba..d6ee7cd5 100644 --- a/charts/forms-flow-analytics/values.yaml +++ b/charts/forms-flow-analytics/values.yaml @@ -569,7 +569,7 @@ migrations: priorityClassName: # externalPostgreSQL -- External PostgreSQL configuration. To use an external PostgreSQL instead of the automatically deployed postgresql chart: set postgresql.enabled to false then uncomment and configure the externalPostgreSQL connection URL (e.g. postgresql://user:pass@host:5432/database) -externalPostgreSQL: postgresql://postgres:postgres@forms-flow-ai-postgresql-ha-pgpool/forms-flow-analytics +externalPostgreSQL: # externalPostgreSQLSecret -- Read external PostgreSQL configuration from a secret. This should point at a secret file with a single key which specifies the connection string. externalPostgreSQLSecret: {} @@ -583,6 +583,7 @@ externalPostgreSQLSecret: postgresql: # postgresql.enabled -- Whether to deploy a PostgreSQL server to satisfy the applications database requirements. To use an external PostgreSQL set this to false and configure the externalPostgreSQL parameter. enabled: false + fullnameOverride: "forms-flow-ai-postgresql-ha-pgpool" primary: service: ports: @@ -592,11 +593,11 @@ postgresql: auth: # postgresql.auth.username -- PostgreSQL username for redash user (when postgresql chart enabled) - username: redash + username: postgres # postgresql.auth.password -- REQUIRED: PostgreSQL password for redash user (when postgresql chart enabled) - password: + password: postgres # postgresql.auth.database -- PostgreSQL database name (when postgresql chart enabled) - database: redash + database: forms-flow-analytics # externalRedis -- External Redis configuration. To use an external Redis instead of the automatically deployed redis chart: set redis.enabled to false then uncomment and configure the externalRedis connection URL (e.g. redis://user:pass@host:6379/database). externalRedis: redis://redis-exporter:6379/0