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

Commit

Permalink
fix: update default values to account for postgresql existingSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
PatAKnight committed Nov 16, 2023
1 parent 8d5e741 commit 14d4a11
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 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.10.4
version: 2.10.5
5 changes: 4 additions & 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.10.4](https://img.shields.io/badge/Version-2.10.4-informational?style=flat-square)
![Version: 2.10.5](https://img.shields.io/badge/Version-2.10.5-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 Expand Up @@ -138,6 +138,9 @@ Kubernetes: `>= 1.19.0-0`
| global.dynamic.includes[0] | List of dynamic plugins included inside the `janus-idp/backstage-showcase` container image, some of which are disabled by default. This file ONLY works with the `janus-idp/backstage-showcase` container image. | string | `"dynamic-plugins.default.yaml"` |
| global.dynamic.plugins | List of dynamic plugins, possibly overriding the plugins listed in `includes` files. Every item defines the plugin `package` as a [NPM package spec](https://docs.npmjs.com/cli/v10/using-npm/package-spec), an optional `pluginConfig` with plugin-specific backstage configuration, and an optional `disabled` flag to disable/enable a plugin listed in `includes` files. It also includes an `integrity` field that is used to verify the plugin package [integrity](https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description). | list | `[]` |
| global.host | Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig` | string | `""` |
| global.postgresql | Global configuration values for PostgreSQL | object | `{"auth":{"existingSecret":""}}` |
| global.postgresql.auth | The authentication details of the Postgres database | object | `{"existingSecret":""}` |
| global.postgresql.auth.existingSecret | Name of existing secret to use for PostgreSQL credentials | string | `""` |
| route | OpenShift Route parameters | object | `{"annotations":{},"enabled":true,"host":"{{ .Values.global.host }}","path":"/","tls":{"caCertificate":"","certificate":"","destinationCACertificate":"","enabled":true,"insecureEdgeTerminationPolicy":"Redirect","key":"","termination":"edge"},"wildcardPolicy":"None"}` |
| route.annotations | Route specific annotations | object | `{}` |
| route.enabled | Enable the creation of the route resource | bool | `true` |
Expand Down
26 changes: 26 additions & 0 deletions charts/backstage/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,29 @@ 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.backstage.existingSecret" -}}
{{- if .Values.postgresql.auth.existingSecret -}}
{{- .Values.postgresql.auth.existingSecret -}}
{{- else if .Values.global.postgresql.auth.existingSecret -}}
{{- .Values.global.postgresql.auth.existingSecret -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name "postgresql" -}}
{{- end -}}
{{- end -}}

{{/*
Sets the secretKeyRef name for PostgreSQL to the PostgreSQL existing secret if it present
*/}}
{{- define "janus-idp.postgresql.existingSecret" -}}
{{- if .Values.auth.existingSecret -}}
{{- .Values.auth.existingSecret -}}
{{- else if .Values.global.postgresql.auth.existingSecret -}}
{{- .Values.global.postgresql.auth.existingSecret -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name "postgresql" -}}
{{- end -}}
{{- end -}}
10 changes: 8 additions & 2 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ global:
existingSecret: ""
# -- Instead of generating a secret value, use fo;lowing value
value: ""
# -- Global configuration values for PostgreSQL
postgresql:
# -- The authentication details of the Postgres database
auth:
# -- Name of existing secret to use for PostgreSQL credentials
existingSecret: ''

# -- Upstream Backstage [chart configuration](https://github.com/backstage/charts/blob/main/charts/backstage/values.yaml)
# @default -- Use Openshift compatible settings
Expand Down Expand Up @@ -91,7 +97,7 @@ upstream:
valueFrom:
secretKeyRef:
key: postgres-password
name: "{{ .Release.Name }}-postgresql"
name: '{{- include "janus-idp.backstage.existingSecret" . }}'

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 @@ -185,7 +191,7 @@ upstream:
valueFrom:
secretKeyRef:
key: postgres-password
name: "{{ .Release.Name }}-postgresql"
name: '{{- include "janus-idp.postgresql.existingSecret" . }}'
ingress:
host: "{{ .Values.global.host }}"

Expand Down

0 comments on commit 14d4a11

Please sign in to comment.