From 12387212edc588cbc445370479253146ca0c3aa6 Mon Sep 17 00:00:00 2001 From: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> Date: Tue, 14 May 2019 12:23:10 +0530 Subject: [PATCH] [stable/postgresql] Use tpl so release name can be used in config maps (#13705) * Use tpl so release name can be used in config maps This runs the config map name through tpl so that templating can be used with config map and secret names in postgres. Otherwise, it limits postgres to a single release when using a custom config map name. This is a workaround for issue: https://github.com/helm/helm/issues/2492 and follows similar solutions used elsewhere: https://github.com/helm/charts/issues/10342 Signed-off-by: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> * Bump chart version Signed-off-by: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> * Update docs to indicate that the value is evaluated as a template Signed-off-by: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> --- stable/postgresql/Chart.yaml | 2 +- stable/postgresql/README.md | 10 +++++----- stable/postgresql/templates/_helpers.tpl | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index 6259c3607d86..aa0fcf54692f 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: postgresql -version: 4.0.2 +version: 4.0.3 appVersion: 10.7.0 description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance. keywords: diff --git a/stable/postgresql/README.md b/stable/postgresql/README.md index 71fed6f19b38..380cafec655b 100644 --- a/stable/postgresql/README.md +++ b/stable/postgresql/README.md @@ -83,11 +83,11 @@ The following tables lists the configurable parameters of the PostgreSQL chart a | `postgresqlConfiguration` | Runtime Config Parameters | `nil` | | `postgresqlExtendedConf` | Extended Runtime Config Parameters (appended to main or default configuration) | `nil` | | `pgHbaConfiguration` | Content of pg\_hba.conf | `nil (do not create pg_hba.conf)` | -| `configurationConfigMap` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresqlConfiguration` and `pgHbaConfiguration`) | `nil` | -| `extendedConfConfigMap` | ConfigMap with the extended PostgreSQL configuration files | `nil` | -| `initdbScripts` | Dictionary of initdb scripts | `nil` | -| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` | -| `initdbScriptsSecret` | Secret with initdb scripts that contain sensitive information (Note: can be used with `initdbScriptsConfigMap` or `initdbScripts`) | `nil` | +| `configurationConfigMap` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresqlConfiguration` and `pgHbaConfiguration`). The value is evaluated as a template. | `nil` | +| `extendedConfConfigMap` | ConfigMap with the extended PostgreSQL configuration files. The value is evaluated as a template. | `nil` | +| `initdbScripts` | Dictionary of initdb scripts | `nil` | +| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`). The value is evaluated as a template. | `nil` | +| `initdbScriptsSecret` | Secret with initdb scripts that contain sensitive information (Note: can be used with `initdbScriptsConfigMap` or `initdbScripts`). The value is evaluated as a template. | `nil` | | `service.type` | Kubernetes Service type | `ClusterIP` | | `service.port` | PostgreSQL port | `5432` | | `service.nodePort` | Kubernetes Service nodePort | `nil` | diff --git a/stable/postgresql/templates/_helpers.tpl b/stable/postgresql/templates/_helpers.tpl index 38dd8f6f07da..40621db836de 100644 --- a/stable/postgresql/templates/_helpers.tpl +++ b/stable/postgresql/templates/_helpers.tpl @@ -220,7 +220,7 @@ Get the configuration ConfigMap name. */}} {{- define "postgresql.configurationCM" -}} {{- if .Values.configurationConfigMap -}} -{{- printf "%s" .Values.configurationConfigMap -}} +{{- printf "%s" (tpl .Values.configurationConfigMap $) -}} {{- else -}} {{- printf "%s-configuration" (include "postgresql.fullname" .) -}} {{- end -}} @@ -231,7 +231,7 @@ Get the extended configuration ConfigMap name. */}} {{- define "postgresql.extendedConfigurationCM" -}} {{- if .Values.extendedConfConfigMap -}} -{{- printf "%s" .Values.extendedConfConfigMap -}} +{{- printf "%s" (tpl .Values.extendedConfConfigMap $) -}} {{- else -}} {{- printf "%s-extended-configuration" (include "postgresql.fullname" .) -}} {{- end -}} @@ -242,7 +242,7 @@ Get the initialization scripts ConfigMap name. */}} {{- define "postgresql.initdbScriptsCM" -}} {{- if .Values.initdbScriptsConfigMap -}} -{{- printf "%s" .Values.initdbScriptsConfigMap -}} +{{- printf "%s" (tpl .Values.initdbScriptsConfigMap $) -}} {{- else -}} {{- printf "%s-init-scripts" (include "postgresql.fullname" .) -}} {{- end -}} @@ -252,7 +252,7 @@ Get the initialization scripts ConfigMap name. Get the initialization scripts Secret name. */}} {{- define "postgresql.initdbScriptsSecret" -}} -{{- printf "%s" .Values.initdbScriptsSecret -}} +{{- printf "%s" (tpl .Values.initdbScriptsSecret $) -}} {{- end -}} {{/*