From e206bf03b08a5d8995bfba95d19b8441a834bc83 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Thu, 26 Dec 2024 16:14:29 +0530 Subject: [PATCH] chore: update postgres user password on init (#214) --- chart/templates/postgres.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/chart/templates/postgres.yaml b/chart/templates/postgres.yaml index ed4d98b2..75ea775b 100644 --- a/chart/templates/postgres.yaml +++ b/chart/templates/postgres.yaml @@ -1,5 +1,14 @@ {{- if eq .Values.db.create true }} --- +apiVersion: v1 +kind: ConfigMap +metadata: + name: postgresql-scripts +data: + post-startup.sh: | + #!/bin/bash + psql -U postgres -c "ALTER USER postgres PASSWORD '${POSTGRES_PASSWORD}';" +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -26,6 +35,10 @@ spec: optional: true - name: logs emptyDir: {} + - name: scripts + configMap: + name: postgresql-scripts + defaultMode: 0755 initContainers: - command: @@ -57,6 +70,11 @@ spec: value: /var/lib/postgresql/data - name: POSTGRES_DB value: mission_control + startupProbe: + initialDelaySeconds: 15 + exec: + command: + - /post-startup.sh volumeMounts: - name: dshm mountPath: /dev/shm @@ -65,6 +83,9 @@ spec: subPath: postgres - name: logs mountPath: /var/log/postgresql + - name: scripts + mountPath: /post-startup.sh + subPath: post-startup.sh envFrom: - secretRef: name: {{ .Values.db.secretKeyRef.name }}