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

Commit

Permalink
Merge pull request #148 from PatAKnight/existing-secret
Browse files Browse the repository at this point in the history
fix: update default values to account for postgresql existingSecret
  • Loading branch information
tumido committed Nov 28, 2023
2 parents 574cd7b + 4d34bf4 commit b3bedfb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/backstage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@
# 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
Expand Down
27 changes: 27 additions & 0 deletions charts/backstage/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
2 changes: 1 addition & 1 deletion charts/backstage/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@
"valueFrom": {
"secretKeyRef": {
"key": "postgres-password",
"name": "{{ .Release.Name }}-postgresql"
"name": "{{- include \"janus-idp.postgresql.secretName\" . }}"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -183,7 +183,7 @@ upstream:
valueFrom:
secretKeyRef:
key: postgres-password
name: "{{ .Release.Name }}-postgresql"
name: '{{- include "postgresql.v1.secretName" . }}'
ingress:
host: "{{ .Values.global.host }}"

Expand Down

0 comments on commit b3bedfb

Please sign in to comment.