Skip to content

Commit

Permalink
Dynamic assignment of custom schema name if defined in update-passwor…
Browse files Browse the repository at this point in the history
…d job (#31146)

* Dynamic assignment of custom schema name if defined

Use value of global.postgres.auth.database as a custom schema name if defined, otherwise use "postgres" as default

Signed-off-by: Dima Zyuryaev <[email protected]>

* Update job.yaml with helper function instead of direct using of Values.yaml

Signed-off-by: Dima Zyuryaev <[email protected]>

* Update Chart.yaml for postgresql with a new version

Signed-off-by: Dima Zyuryaev <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

* Update Chart.yaml

Signed-off-by: Dima Zyuryaev <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

---------

Signed-off-by: Dima Zyuryaev <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]>
Signed-off-by: Carlos Rodríguez Hernández <[email protected]>
Co-authored-by: Bitnami Containers <[email protected]>
Co-authored-by: Carlos Rodríguez Hernández <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2025
1 parent c409f1f commit 364ac45
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions bitnami/postgresql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 16.3.5 (2025-01-03)
## 16.4.1 (2025-01-13)

* Revert "[bitnami/postgresql] Add Storage Class Configuration to Templates (#30858)" ([#31204](https://github.com/bitnami/charts/pull/31204))
* Dynamic assignment of custom schema name if defined in update-password job ([#31146](https://github.com/bitnami/charts/pull/31146))

## <small>16.3.5 (2025-01-03)</small>

* Revert "[bitnami/postgresql] Add Storage Class Configuration to Templates (#30858)" (#31204) ([c03fe0c](https://github.com/bitnami/charts/commit/c03fe0c3e359db15c2c096d52e6e28e480dfdbd6)), closes [#30858](https://github.com/bitnami/charts/issues/30858) [#31204](https://github.com/bitnami/charts/issues/31204)

## <small>16.3.4 (2024-12-23)</small>

Expand Down
2 changes: 1 addition & 1 deletion bitnami/postgresql/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ maintainers:
name: postgresql
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/postgresql
version: 16.3.5
version: 16.4.1
5 changes: 3 additions & 2 deletions bitnami/postgresql/templates/update-password/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
args:
- |
{{- $customUser := include "postgresql.v1.username" . }}
{{- $customDatabase := include "postgresql.v1.database" | default "postgres" }}
{{- if .Values.usePasswordFiles }}
# We need to load all the secret env vars to the system
for file in $(find /bitnami/postgresql/secrets -type f); do
Expand Down Expand Up @@ -87,7 +88,7 @@ spec:
info "User password already updated. Skipping"
else
info "Updating user password"
echo "ALTER USER {{ $customUser }} WITH PASSWORD '$POSTGRESQL_NEW_PASSWORD';" | postgresql_remote_execute $primary_host {{ .Values.containerPorts.postgresql }} "postgres" $POSTGRESQL_USER $POSTGRESQL_PREVIOUS_PASSWORD
echo "ALTER USER {{ $customUser }} WITH PASSWORD '$POSTGRESQL_NEW_PASSWORD';" | postgresql_remote_execute $primary_host {{ .Values.containerPorts.postgresql }} "{{ $customDatabase }}" $POSTGRESQL_USER $POSTGRESQL_PREVIOUS_PASSWORD
touch /job-status/password-changed
info "User password successfully updated"
fi
Expand All @@ -97,7 +98,7 @@ spec:
info "Replication password already updated. Skipping"
else
info "Updating replication password"
echo "ALTER USER $POSTGRESQL_REPLICATION_USER WITH PASSWORD '$POSTGRESQL_NEW_REPLICATION_PASSWORD';" | postgresql_remote_execute $primary_host {{ .Values.containerPorts.postgresql }} "postgres" $POSTGRESQL_REPLICATION_USER $POSTGRESQL_PREVIOUS_REPLICATION_PASSWORD
echo "ALTER USER $POSTGRESQL_REPLICATION_USER WITH PASSWORD '$POSTGRESQL_NEW_REPLICATION_PASSWORD';" | postgresql_remote_execute $primary_host {{ .Values.containerPorts.postgresql }} "{{ $customDatabase }}" $POSTGRESQL_REPLICATION_USER $POSTGRESQL_PREVIOUS_REPLICATION_PASSWORD
touch /job-status/replication-password-changed
info "Replication password successfully updated"
fi
Expand Down

0 comments on commit 364ac45

Please sign in to comment.