From cf8d48677b874eb373f88735ee5385323da73996 Mon Sep 17 00:00:00 2001 From: tm8enk Date: Mon, 8 Feb 2021 11:13:53 +0000 Subject: [PATCH] allow multiple postgres for pgadmin --- charts/pgadmin/Chart.yaml | 2 +- charts/pgadmin/templates/_helpers.tpl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/pgadmin/Chart.yaml b/charts/pgadmin/Chart.yaml index 945c5ff6..f4c08ccf 100644 --- a/charts/pgadmin/Chart.yaml +++ b/charts/pgadmin/Chart.yaml @@ -15,7 +15,7 @@ type: application # 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: 0.2.1 +version: 0.2.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/pgadmin/templates/_helpers.tpl b/charts/pgadmin/templates/_helpers.tpl index 09e7dffd..45040a0a 100644 --- a/charts/pgadmin/templates/_helpers.tpl +++ b/charts/pgadmin/templates/_helpers.tpl @@ -76,9 +76,13 @@ nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelis {{- define "pgadmin.configmap" -}} {{ printf "{" }} -{{ printf "\"Servers\": {" | indent 2 }} +{{ printf "\"Servers\": {" | indent 2 }} +{{- $virgule := 0 }} {{ range $index, $service := (lookup "v1" "Service" .Release.Namespace "").items }} {{- if hasPrefix "postgres" (index $service "metadata" "labels" "helm.sh/chart") }} +{{- if $virgule }} +{{ printf "," }} +{{- end }} {{ printf "\"%d\" :{" $index | indent 4}} {{ printf "\"Name\": \"%s\"," $service.metadata.name | indent 6}} {{ printf "\"Group\": \"Autodiscovery\"," | indent 6}} @@ -87,6 +91,7 @@ nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelis {{ printf "\"Username\": \"%s\"," (trimPrefix "user-" $service.metadata.namespace) | indent 6}} {{ printf "\"SSLMode\": \"prefer\"," | indent 6 }} {{ printf "\"MaintenanceDB\": \"postgres\"" | indent 6}} +{{- $virgule = 1}} {{ printf "}" | indent 4}} {{- end }}