From 1b41758add369d78a9aa71a57a21bcb5b99bac3e Mon Sep 17 00:00:00 2001 From: Tom Coufal <7453394+tumido@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:43:51 +0100 Subject: [PATCH] fix: honor .global.postgresql.auth values (#154) Signed-off-by: Tomas Coufal --- charts/backstage/Chart.yaml | 2 +- charts/backstage/README.md | 2 +- charts/backstage/templates/_helpers.tpl | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/charts/backstage/Chart.yaml b/charts/backstage/Chart.yaml index fa39b9b..f73137a 100644 --- a/charts/backstage/Chart.yaml +++ b/charts/backstage/Chart.yaml @@ -38,4 +38,4 @@ sources: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.8.0 +version: 1.8.1 diff --git a/charts/backstage/README.md b/charts/backstage/README.md index 5fe01a8..f4039fc 100644 --- a/charts/backstage/README.md +++ b/charts/backstage/README.md @@ -2,7 +2,7 @@ # Backstage Helm Chart [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/backstage)](https://artifacthub.io/packages/search?repo=backstage) -![Version: 1.8.0](https://img.shields.io/badge/Version-1.8.0-informational?style=flat-square) +![Version: 1.8.1](https://img.shields.io/badge/Version-1.8.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) A Helm chart for deploying a Backstage application diff --git a/charts/backstage/templates/_helpers.tpl b/charts/backstage/templates/_helpers.tpl index 1237418..89f93b3 100644 --- a/charts/backstage/templates/_helpers.tpl +++ b/charts/backstage/templates/_helpers.tpl @@ -46,7 +46,9 @@ Return the Postgres Database hostname Return the Postgres Database Secret Name */}} {{- define "backstage.postgresql.databaseSecretName" -}} -{{- if .Values.postgresql.auth.existingSecret }} +{{- if ((((.Values).global).postgresql).auth).existingSecret }} + {{- tpl .Values.global.postgresql.auth.existingSecret $ -}} +{{- else if .Values.postgresql.auth.existingSecret }} {{- tpl .Values.postgresql.auth.existingSecret $ -}} {{- else -}} {{- default (include "backstage.postgresql.fullname" .) (tpl .Values.postgresql.auth.existingSecret $) -}} @@ -57,9 +59,16 @@ Return the Postgres Database Secret Name Return the Postgres databaseSecret key to retrieve credentials for database */}} {{- define "backstage.postgresql.databaseSecretKey" -}} -{{- if .Values.postgresql.auth.existingSecret -}} - {{- .Values.postgresql.auth.secretKeys.userPasswordKey -}} +{{- $defaultDatabaseSecretKey := "password" -}} +{{- if (or ((((.Values).global).postgresql).auth).existingSecret .Values.postgresql.auth.existingSecret) }} + {{- if (((((.Values).global).postgresql).auth).secretKeys).userPasswordKey -}} + {{- .Values.global.postgresql.auth.secretKeys.userPasswordKey -}} + {{- else if ((((.Values).postgresql).auth).secretKeys).userPasswordKey -}} + {{- .Values.postgresql.auth.secretKeys.userPasswordKey -}} + {{- else -}} + {{- print $defaultDatabaseSecretKey -}} + {{- end -}} {{- else -}} - {{- print "password" -}} + {{- print $defaultDatabaseSecretKey -}} {{- end -}} {{- end -}}