Skip to content

Commit

Permalink
chore: update postgres user password on init (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored Dec 26, 2024
1 parent 6e75633 commit e206bf0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions chart/templates/postgres.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -26,6 +35,10 @@ spec:
optional: true
- name: logs
emptyDir: {}
- name: scripts
configMap:
name: postgresql-scripts
defaultMode: 0755

initContainers:
- command:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down

0 comments on commit e206bf0

Please sign in to comment.