Skip to content

Commit

Permalink
fix: honor .global.postgresql.auth values (backstage#154)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Coufal <tcoufal@redhat.com>
  • Loading branch information
tumido authored Dec 1, 2023
1 parent 58edf6e commit 1b41758
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/backstage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion charts/backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions charts/backstage/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 $) -}}
Expand All @@ -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 -}}

0 comments on commit 1b41758

Please sign in to comment.