Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit b3bedfb

Browse files
authored
Merge pull request #148 from PatAKnight/existing-secret
fix: update default values to account for postgresql existingSecret
2 parents 574cd7b + 4d34bf4 commit b3bedfb

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

charts/backstage/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ sources:
4141
# This is the chart version. This version number should be incremented each time you make changes
4242
# to the chart and its templates, including the app version.
4343
# Versions are expected to follow Semantic Versioning (https://semver.org/)
44-
version: 2.11.2
44+
version: 2.11.3

charts/backstage/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Janus-IDP Backstage Helm Chart
33

44
[![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)
5-
![Version: 2.11.2](https://img.shields.io/badge/Version-2.11.2-informational?style=flat-square)
5+
![Version: 2.11.3](https://img.shields.io/badge/Version-2.11.3-informational?style=flat-square)
66
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
77

88
A Helm chart for deploying a Backstage application

charts/backstage/templates/_helpers.tpl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,30 @@ Returns a secret name for service to service auth
2121
{{- include "common.names.fullname" . -}}-auth
2222
{{- end -}}
2323
{{- end -}}
24+
25+
{{/*
26+
Sets the secretKeyRef name for Backstage to the PostgreSQL existing secret if it present
27+
*/}}
28+
{{- define "janus-idp.postgresql.secretName" -}}
29+
{{- if ((((.Values).global).postgresql).auth).existingSecret -}}
30+
{{- .Values.global.postgresql.auth.existingSecret -}}
31+
{{- else if .Values.postgresql.auth.existingSecret -}}
32+
{{- .Values.postgresql.auth.existingSecret -}}
33+
{{- else -}}
34+
{{- printf "%s-%s" .Release.Name "postgresql" -}}
35+
{{- end -}}
36+
{{- end -}}
37+
38+
{{/*
39+
Get the password secret.
40+
Referenced from: https://github.com/bitnami/charts/blob/main/bitnami/postgresql/templates/_helpers.tpl#L94-L105
41+
*/}}
42+
{{- define "postgresql.v1.secretName" -}}
43+
{{- if .Values.global.postgresql.auth.existingSecret -}}
44+
{{- printf "%s" (tpl .Values.global.postgresql.auth.existingSecret $) -}}
45+
{{- else if .Values.auth.existingSecret -}}
46+
{{- printf "%s" (tpl .Values.auth.existingSecret $) -}}
47+
{{- else -}}
48+
{{- printf "%s" (include "common.names.fullname" .) -}}
49+
{{- end -}}
50+
{{- end -}}

charts/backstage/values.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@
15811581
"valueFrom": {
15821582
"secretKeyRef": {
15831583
"key": "postgres-password",
1584-
"name": "{{ .Release.Name }}-postgresql"
1584+
"name": "{{- include \"janus-idp.postgresql.secretName\" . }}"
15851585
}
15861586
}
15871587
}

charts/backstage/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ upstream:
9191
valueFrom:
9292
secretKeyRef:
9393
key: postgres-password
94-
name: "{{ .Release.Name }}-postgresql"
94+
name: '{{- include "janus-idp.postgresql.secretName" . }}'
9595

9696
args:
9797
# 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:
183183
valueFrom:
184184
secretKeyRef:
185185
key: postgres-password
186-
name: "{{ .Release.Name }}-postgresql"
186+
name: '{{- include "postgresql.v1.secretName" . }}'
187187
ingress:
188188
host: "{{ .Values.global.host }}"
189189

0 commit comments

Comments
 (0)