mirror of
https://github.com/bitnami/charts.git
synced 2026-04-01 06:47:23 +08:00
[bitnami/postgresql] Add pre-init scripts (#26467)
* [bitnami/postgresql] Add pre-init scripts Signed-off-by: onichandame <zxinmyth@gmail.com> * Update CHANGELOG.md Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> * Update CHANGELOG.md Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> * Update CHANGELOG.md Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> --------- Signed-off-by: onichandame <zxinmyth@gmail.com> Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> Signed-off-by: Rafael Ríos Saavedra <rrios@vmware.com> Signed-off-by: Carlos Rodríguez Hernández <carlosrh@vmware.com> Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com> Co-authored-by: Rafael Ríos Saavedra <rrios@vmware.com> Co-authored-by: Carlos Rodríguez Hernández <carlosrh@vmware.com>
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 15.5.7 (2024-06-18)
|
||||
## 15.5.8 (2024-06-19)
|
||||
|
||||
* [bitnami/postgresql] Release 15.5.7 ([#27401](https://github.com/bitnami/charts/pull/27401))
|
||||
* [bitnami/postgresql] Add pre-init scripts ([#26467](https://github.com/bitnami/charts/pull/26467))
|
||||
|
||||
## <small>15.5.7 (2024-06-18)</small>
|
||||
|
||||
* [bitnami/postgresql] Release 15.5.7 (#27401) ([2fff79d](https://github.com/bitnami/charts/commit/2fff79d0d54da3680cb8dac3652884c82c314e74)), closes [#27401](https://github.com/bitnami/charts/issues/27401)
|
||||
|
||||
## <small>15.5.6 (2024-06-17)</small>
|
||||
|
||||
|
||||
@@ -35,4 +35,4 @@ maintainers:
|
||||
name: postgresql
|
||||
sources:
|
||||
- https://github.com/bitnami/charts/tree/main/bitnami/postgresql
|
||||
version: 15.5.7
|
||||
version: 15.5.8
|
||||
|
||||
@@ -384,6 +384,9 @@ If you already have data in it, you will fail to sync to standby nodes for all c
|
||||
| `primary.initdb.scriptsSecret` | Secret with scripts to be run at first boot (in case it contains sensitive information) | `""` |
|
||||
| `primary.initdb.user` | Specify the PostgreSQL username to execute the initdb scripts | `""` |
|
||||
| `primary.initdb.password` | Specify the PostgreSQL password to execute the initdb scripts | `""` |
|
||||
| `primary.preInitDb.scripts` | Dictionary of pre-init scripts | `{}` |
|
||||
| `primary.preInitDb.scriptsConfigMap` | ConfigMap with pre-init scripts to be run | `""` |
|
||||
| `primary.preInitDb.scriptsSecret` | Secret with pre-init scripts to be run | `""` |
|
||||
| `primary.standby.enabled` | Whether to enable current cluster's primary as standby server of another cluster or not | `false` |
|
||||
| `primary.standby.primaryHost` | The Host of replication primary in the other cluster | `""` |
|
||||
| `primary.standby.primaryPort` | The Port of replication primary in the other cluster | `""` |
|
||||
|
||||
@@ -267,6 +267,17 @@ Return true if a configmap should be mounted with PostgreSQL configuration
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the pre-initialization scripts ConfigMap name.
|
||||
*/}}
|
||||
{{- define "postgresql.v1.preInitDb.scriptsCM" -}}
|
||||
{{- if .Values.primary.preInitDb.scriptsConfigMap -}}
|
||||
{{- printf "%s" (tpl .Values.primary.preInitDb.scriptsConfigMap $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-preinit-scripts" (include "postgresql.v1.primary.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the initialization scripts ConfigMap name.
|
||||
*/}}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- /*
|
||||
Copyright Broadcom, Inc. All Rights Reserved.
|
||||
SPDX-License-Identifier: APACHE-2.0
|
||||
*/}}
|
||||
|
||||
{{- if and .Values.primary.preInitDb.scripts (not .Values.primary.preInitDb.scriptsConfigMap) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ printf "%s-preinit-scripts" (include "postgresql.v1.primary.fullname" .) }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data: {{- include "common.tplvalues.render" (dict "value" .Values.primary.preInitDb.scripts "context" .) | nindent 2 }}
|
||||
{{- end }}
|
||||
@@ -466,6 +466,14 @@ spec:
|
||||
- name: empty-dir
|
||||
mountPath: /opt/bitnami/postgresql/tmp
|
||||
subPath: app-tmp-dir
|
||||
{{- if or .Values.primary.preInitDb.scriptsConfigMap .Values.primary.preInitDb.scripts }}
|
||||
- name: custom-preinit-scripts
|
||||
mountPath: /docker-entrypoint-preinitdb.d/
|
||||
{{- end }}
|
||||
{{- if .Values.primary.preInitDb.scriptsSecret }}
|
||||
- name: custom-preinit-scripts-secret
|
||||
mountPath: /docker-entrypoint-preinitdb.d/secret
|
||||
{{- end }}
|
||||
{{- if or .Values.primary.initdb.scriptsConfigMap .Values.primary.initdb.scripts }}
|
||||
- name: custom-init-scripts
|
||||
mountPath: /docker-entrypoint-initdb.d/
|
||||
@@ -611,6 +619,16 @@ spec:
|
||||
secret:
|
||||
secretName: {{ include "postgresql.v1.secretName" . }}
|
||||
{{- end }}
|
||||
{{- if or .Values.primary.preInitDb.scriptsConfigMap .Values.primary.preInitDb.scripts }}
|
||||
- name: custom-preinit-scripts
|
||||
configMap:
|
||||
name: {{ include "postgresql.v1.preInitDb.scriptsCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.primary.preInitDb.scriptsSecret }}
|
||||
- name: custom-preinit-scripts-secret
|
||||
secret:
|
||||
secretName: {{ tpl .Values.primary.preInitDb.scriptsSecret $ }}
|
||||
{{- end }}
|
||||
{{- if or .Values.primary.initdb.scriptsConfigMap .Values.primary.initdb.scripts }}
|
||||
- name: custom-init-scripts
|
||||
configMap:
|
||||
|
||||
@@ -357,6 +357,23 @@ primary:
|
||||
## @param primary.initdb.password Specify the PostgreSQL password to execute the initdb scripts
|
||||
##
|
||||
password: ""
|
||||
## Pre-init configuration
|
||||
## ref: https://github.com/bitnami/containers/tree/main/bitnami/postgresql/#on-container-start
|
||||
preInitDb:
|
||||
## @param primary.preInitDb.scripts Dictionary of pre-init scripts
|
||||
## Specify dictionary of shell scripts to be run before db boot
|
||||
## e.g:
|
||||
## scripts:
|
||||
## my_pre_init_script.sh: |
|
||||
## #!/bin/sh
|
||||
## echo "Do something."
|
||||
scripts: {}
|
||||
## @param primary.preInitDb.scriptsConfigMap ConfigMap with pre-init scripts to be run
|
||||
## NOTE: This will override `primary.preInitDb.scripts`
|
||||
scriptsConfigMap: ""
|
||||
## @param primary.preInitDb.scriptsSecret Secret with pre-init scripts to be run
|
||||
## NOTE: This can work along `primary.preInitDb.scripts` or `primary.preInitDb.scriptsConfigMap`
|
||||
scriptsSecret: ""
|
||||
## Configure current cluster's primary server to be the standby server in other cluster.
|
||||
## This will allow cross cluster replication and provide cross cluster high availability.
|
||||
## You will need to configure pgHbaConfiguration if you want to enable this feature with local cluster replication enabled.
|
||||
|
||||
Reference in New Issue
Block a user