diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index 35584da96b..954b2add3f 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -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: diff --git a/stable/postgresql/README.md b/stable/postgresql/README.md index bb318ba33a..0a5d5dc553 100644 --- a/stable/postgresql/README.md +++ b/stable/postgresql/README.md @@ -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. diff --git a/stable/postgresql/files/conf.d/README.md b/stable/postgresql/files/conf.d/README.md new file mode 100644 index 0000000000..184c1875d5 --- /dev/null +++ b/stable/postgresql/files/conf.d/README.md @@ -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). diff --git a/stable/postgresql/templates/extended-config-configmap.yaml b/stable/postgresql/templates/extended-config-configmap.yaml new file mode 100644 index 0000000000..5c232a0c75 --- /dev/null +++ b/stable/postgresql/templates/extended-config-configmap.yaml @@ -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 }} diff --git a/stable/postgresql/templates/statefulset-slaves.yaml b/stable/postgresql/templates/statefulset-slaves.yaml index 5f5e0a9d36..d73952f6a4 100644 --- a/stable/postgresql/templates/statefulset-slaves.yaml +++ b/stable/postgresql/templates/statefulset-slaves.yaml @@ -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 }} diff --git a/stable/postgresql/templates/statefulset.yaml b/stable/postgresql/templates/statefulset.yaml index ed567a5f88..cf5dfeb0c8 100644 --- a/stable/postgresql/templates/statefulset.yaml +++ b/stable/postgresql/templates/statefulset.yaml @@ -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: