[stable/postgresql] Allows overwrite default config file using include_dir (#10133)

* [stable/postgresql] Allows overwrite default config file using include_dir

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>

* Remove duplicated if statement

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>

* Change README wording

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>

* Bump major version

Signed-off-by: Carlos Rodriguez Hernandez <crhernandez@bitnami.com>
This commit is contained in:
Carlos Rodríguez Hernández
2018-12-19 07:58:46 -08:00
committed by Kubernetes Prow Robot
parent e519db8a67
commit 4a4875755d
6 changed files with 42 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: postgresql
version: 3.2.1
version: 3.3.0
appVersion: 10.6.0
description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
+5
View File
@@ -146,6 +146,11 @@ Add your custom file to "files/postgresql.conf" in your working directory. This
Alternatively, you can specify PostgreSQL configuration parameters using the `postgresqlConfiguration` parameter as a dict, using camelCase, e.g. {"sharedBuffers": "500MB"}.
### Allow settings to be loaded from files other than the default `postgresql.conf`
If you don't want to provide the whole PostgreSQL configuration file and only specify certain parameters, you can add your extended `.conf` files to "files/conf.d/" in your working directory.
Those files will be mounted as configMap to the containers adding/overwriting the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
## Initialize a fresh instance
The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap.
+4
View File
@@ -0,0 +1,4 @@
If you don't want to provide the whole configuration file and only specify certain parameters, you can copy here your extended `.conf` files.
These files will be injected as a config maps and add/overwrite the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
More info in the [bitnami-docker-postgresql README](https://github.com/bitnami/bitnami-docker-postgresql#configuration-file).
@@ -0,0 +1,13 @@
{{- if (.Files.Glob "files/conf.d/*.conf") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "postgresql.fullname" . }}-extended-configuration
labels:
app: {{ template "postgresql.name" . }}
chart: {{ template "postgresql.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
data:
{{ (.Files.Glob "files/conf.d/*.conf").AsConfig | indent 2 }}
{{- end }}
@@ -91,7 +91,7 @@ spec:
{{- if .Values.usePasswordFile }}
- name: POSTGRESQL_REPLICATION_PASSWORD_FILE
value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
{{- else }}
{{- else }}
- name: POSTGRESQL_REPLICATION_PASSWORD
valueFrom:
secretKeyRef:
@@ -152,6 +152,10 @@ spec:
mountPath: /opt/bitnami/postgresql/conf/pg_hba.conf
subPath: pg_hba.conf
{{ end }}
{{- if (.Files.Glob "files/conf.d/*.conf") }}
- name: postgresql-extended-config
mountPath: /opt/bitnami/postgresql/conf/conf.d/
{{- end }}
volumes:
{{- if .Values.usePasswordFile }}
- name: postgresql-password
@@ -163,6 +167,11 @@ spec:
configMap:
name: {{ template "postgresql.fullname" . }}-configuration
{{ end }}
{{- if (.Files.Glob "files/conf.d/*.conf") }}
- name: postgresql-extended-config
configMap:
name: {{ template "postgresql.fullname" . }}-extended-configuration
{{- end }}
updateStrategy:
type: {{ .Values.updateStrategy.type }}
{{- if .Values.persistence.enabled }}
@@ -159,6 +159,10 @@ spec:
- name: custom-init-scripts
mountPath: /docker-entrypoint-initdb.d
{{- end }}
{{- if (.Files.Glob "files/conf.d/*.conf") }}
- name: postgresql-extended-config
mountPath: /opt/bitnami/postgresql/conf/conf.d/
{{- end }}
{{- if .Values.usePasswordFile }}
- name: postgresql-password
mountPath: /opt/bitnami/postgresql/secrets/
@@ -236,6 +240,11 @@ spec:
configMap:
name: {{ template "postgresql.fullname" . }}-configuration
{{- end }}
{{- if (.Files.Glob "files/conf.d/*.conf") }}
- name: postgresql-extended-config
configMap:
name: {{ template "postgresql.fullname" . }}-extended-configuration
{{- end }}
{{- if .Values.usePasswordFile }}
- name: postgresql-password
secret: