From fb8bd654f327500715fdc36fbc2c19c9f5c94308 Mon Sep 17 00:00:00 2001 From: David Burke Date: Fri, 21 May 2021 10:54:39 -0400 Subject: [PATCH] . --- templates/_helpers.tpl | 2 +- templates/configmap.yaml | 1 + templates/pre-install-job.yaml | 5 +++++ values.yaml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 636ed20..8bb6d7c 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -96,7 +96,7 @@ Set postgresql url */}} {{- define "django.postgresql.url" -}} {{- if .Values.postgresql.enabled -}} -postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{- template "django.postgresql.fullname" . -}}:{{- template "django.postgresql.port" . -}}/{{ .Values.postgresql.postgresqlDatabase }} +postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{- template "django.postgresql.fullname" . -}} {{- end -}} {{- end -}} diff --git a/templates/configmap.yaml b/templates/configmap.yaml index 059f000..b291e1f 100644 --- a/templates/configmap.yaml +++ b/templates/configmap.yaml @@ -10,3 +10,4 @@ data: {{- range $k, $v := .Values.env.normal }} {{ $k }}: {{ $v | quote }} {{- end }} + DATABASE_URL: {{ include "django.postgresql.url" . | quote }} \ No newline at end of file diff --git a/templates/pre-install-job.yaml b/templates/pre-install-job.yaml index d8498c8..85f8a36 100644 --- a/templates/pre-install-job.yaml +++ b/templates/pre-install-job.yaml @@ -24,7 +24,12 @@ spec: env: - name: DEBUG value: "False" +{{- if .Values.env.secret.DATABASE_URL }} - name: DATABASE_URL value: {{ required "env.secret.DATABASE_URL is a required value." .Values.env.secret.DATABASE_URL }} +{{- else if .Values.postgresql.enabled }} + - name: DATABASE_URL + value: {{ include "django.postgresql.url" . | b64enc | quote }} +{{- end }} - name: SECRET_KEY value: {{ required "secretKey is a required value." .Values.secretKey }} diff --git a/values.yaml b/values.yaml index 7e500da..ee44a93 100644 --- a/values.yaml +++ b/values.yaml @@ -117,3 +117,4 @@ redis: # Default to disabled, use a managed database service. But can be enabled here. postgresql: enabled: false + postgresqlPassword: # Must be set