From 4d34bf417637e02541080887507cd0f579997bb2 Mon Sep 17 00:00:00 2001 From: Patrick Knight Date: Mon, 13 Nov 2023 08:10:46 -0500 Subject: [PATCH] fix: update default values to account for postgresql existingSecret --- charts/backstage/Chart.yaml | 2 +- charts/backstage/README.md | 2 +- charts/backstage/templates/_helpers.tpl | 27 +++++++++++++++++++++++++ charts/backstage/values.schema.json | 2 +- charts/backstage/values.yaml | 4 ++-- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/charts/backstage/Chart.yaml b/charts/backstage/Chart.yaml index f560fd01..48173194 100644 --- a/charts/backstage/Chart.yaml +++ b/charts/backstage/Chart.yaml @@ -41,4 +41,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: 2.11.2 +version: 2.11.3 diff --git a/charts/backstage/README.md b/charts/backstage/README.md index 280e5137..ef34ad17 100644 --- a/charts/backstage/README.md +++ b/charts/backstage/README.md @@ -2,7 +2,7 @@ # Janus-IDP Backstage Helm Chart [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/janus-idp&style=flat-square)](https://artifacthub.io/packages/search?repo=janus-idp) -![Version: 2.11.2](https://img.shields.io/badge/Version-2.11.2-informational?style=flat-square) +![Version: 2.11.3](https://img.shields.io/badge/Version-2.11.3-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 f7869893..53101c0f 100644 --- a/charts/backstage/templates/_helpers.tpl +++ b/charts/backstage/templates/_helpers.tpl @@ -21,3 +21,30 @@ Returns a secret name for service to service auth {{- include "common.names.fullname" . -}}-auth {{- end -}} {{- end -}} + +{{/* +Sets the secretKeyRef name for Backstage to the PostgreSQL existing secret if it present +*/}} +{{- define "janus-idp.postgresql.secretName" -}} + {{- if ((((.Values).global).postgresql).auth).existingSecret -}} + {{- .Values.global.postgresql.auth.existingSecret -}} + {{- else if .Values.postgresql.auth.existingSecret -}} + {{- .Values.postgresql.auth.existingSecret -}} + {{- else -}} + {{- printf "%s-%s" .Release.Name "postgresql" -}} + {{- end -}} +{{- end -}} + +{{/* +Get the password secret. +Referenced from: https://github.com/bitnami/charts/blob/main/bitnami/postgresql/templates/_helpers.tpl#L94-L105 +*/}} +{{- define "postgresql.v1.secretName" -}} + {{- if .Values.global.postgresql.auth.existingSecret -}} + {{- printf "%s" (tpl .Values.global.postgresql.auth.existingSecret $) -}} + {{- else if .Values.auth.existingSecret -}} + {{- printf "%s" (tpl .Values.auth.existingSecret $) -}} + {{- else -}} + {{- printf "%s" (include "common.names.fullname" .) -}} + {{- end -}} +{{- end -}} diff --git a/charts/backstage/values.schema.json b/charts/backstage/values.schema.json index 3eddaab1..ea7a7626 100644 --- a/charts/backstage/values.schema.json +++ b/charts/backstage/values.schema.json @@ -1581,7 +1581,7 @@ "valueFrom": { "secretKeyRef": { "key": "postgres-password", - "name": "{{ .Release.Name }}-postgresql" + "name": "{{- include \"janus-idp.postgresql.secretName\" . }}" } } } diff --git a/charts/backstage/values.yaml b/charts/backstage/values.yaml index d1949416..725523da 100644 --- a/charts/backstage/values.yaml +++ b/charts/backstage/values.yaml @@ -91,7 +91,7 @@ upstream: valueFrom: secretKeyRef: key: postgres-password - name: "{{ .Release.Name }}-postgresql" + name: '{{- include "janus-idp.postgresql.secretName" . }}' args: # This additional `app-config`` file is generated by the initContainer below, and contains the merged configuration of installed dynamic plugins. @@ -183,7 +183,7 @@ upstream: valueFrom: secretKeyRef: key: postgres-password - name: "{{ .Release.Name }}-postgresql" + name: '{{- include "postgresql.v1.secretName" . }}' ingress: host: "{{ .Values.global.host }}"