[dendrite] Fix postgresql init scripts for dendrite (#1368)

* fix(dendrite/postgresql): fix init scripts

Init scripts for postgresql not are generated dynamically so the correct
username is used. Additionally they are loaded from a configmap rather
than injected into the values which did not work.

Also refactored into separated file for easier maintenance.

* docs(dendrite): Bump version and update changelog annotations

* docs(dendrite): Generate README
This commit is contained in:
Jonathan Bartlett 2022-01-10 23:32:07 +00:00 committed by GitHub
parent 50d0d5e7c8
commit eee839e548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 15 deletions

View File

@ -3,7 +3,7 @@ apiVersion: v2
appVersion: 0.5.1
description: Dendrite Matrix Homeserver
name: dendrite
version: 1.0.1
version: 1.0.2
kubeVersion: ">=1.16.0-0"
keywords:
- dendrite
@ -29,4 +29,8 @@ dependencies:
annotations:
artifacthub.io/changes: |
- kind: changed
description: Upgraded `postgresql` chart dependency to version `10.14.4`.
description: Upgraded `postgresql` image version to "14.1.0"
- kind: fixed
description: "`initdbScripts` are now actually actually loaded"
- kind: added
description: "`postgresqlUsername` is used in `initdbScripts` rather than hardcoded value"

View File

@ -1,6 +1,6 @@
# dendrite
![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![AppVersion: 0.5.1](https://img.shields.io/badge/AppVersion-0.5.1-informational?style=flat-square)
![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.2-informational?style=flat-square) ![AppVersion: 0.5.1](https://img.shields.io/badge/AppVersion-0.5.1-informational?style=flat-square)
Dendrite Matrix Homeserver
@ -109,6 +109,9 @@ N/A
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. |
| postgresql.enabled | bool | See value.yaml | Enable and configure postgres as the database for dendrite. |
| postgresql.image.repository | string | `"bitnami/postgresql"` | |
| postgresql.image.tag | string | `"14.1.0"` | |
| postgresql.initdbScriptsConfigMap | string | `"dendrite-postgresql-init-scripts"` | |
| postgresql.persistence.enabled | bool | `false` | |
| postgresql.postgresqlDatabase | string | `"dendrite"` | |
| postgresql.postgresqlPassword | string | `"changeme"` | |
@ -119,19 +122,19 @@ N/A
## Changelog
### Version 1.0.1
### Version 1.0.2
#### Added
N/A
* `postgresqlUsername` is used in `initdbScripts` rather than hardcoded value
#### Changed
* Upgraded `postgresql` chart dependency to version `10.14.4`.
* Upgraded `postgresql` image version to "14.1.0"
#### Fixed
N/A
* `initdbScripts` are now actually actually loaded
### Older versions

View File

@ -38,13 +38,5 @@ subPath:
{{- $_ := set .Values.persistence "dendrite-key" (include "dendrite.keyVolume" . | fromYaml) -}}
{{- $_ := set .Values.persistence "dendrite-config" (include "dendrite.configVolume" . | fromYaml) -}}
{{- $_ := set .Values.persistence "dendrite-tls" (include "dendrite.tlsVolume" . | fromYaml) -}}
{{- define "postgresql.initdbScripts" -}}
create_db.sh: |
#!/bin/sh
for db in userapi_accounts userapi_devices mediaapi syncapi roomserver keyserver federationapi appservice naffka; do
createdb -U dendrite -O dendrite dendrite_$db
done
{{- end -}}
{{- $_ := set .Values.postgresql "initdbScripts" (include "postgresql.initdbScripts" . | fromYaml) -}}
{{ include "common.all" . }}

View File

@ -0,0 +1,14 @@
{{- if .Values.postgresql.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: {{ .Values.postgresql.initdbScriptsConfigMap | quote }}
data:
create-db.sh: |
#!/bin/sh
for db in userapi_accounts userapi_devices mediaapi syncapi roomserver keyserver federationapi appservice naffka; do
createdb -U {{ .Values.postgresql.postgresqlUsername }} -O {{ .Values.postgresql.postgresqlUsername }} dendrite_$db
done
{{- end }}

View File

@ -201,8 +201,12 @@ postgresql:
# -- Enable and configure postgres as the database for dendrite.
# @default -- See value.yaml
enabled: false
image:
repository: bitnami/postgresql
tag: "14.1.0"
postgresqlUsername: dendrite
postgresqlPassword: changeme
postgresqlDatabase: dendrite
persistence:
enabled: false
initdbScriptsConfigMap: "dendrite-postgresql-init-scripts"