feat(mariadb): Add template support for existing secrets

Signed-off-by: Axel Lender <lender@b1-systems.de>
This commit is contained in:
Axel Lender
2025-12-03 20:47:03 +01:00
parent 3890df064e
commit c656786bc0
3 changed files with 52 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ This document covers how to utilise existing secrets and special requirements. T
* [Components](#components)
* [Cassandra](#cassandra)
* [Keycloak](#keycloak)
* [MariaDB](#mariadb)
* [MinIO](#minio)
* [Notes](#notes)
* [OpenProject](#openproject)
@@ -120,6 +121,46 @@ Values taken from those existing secrets will supersede secret values that are a
clientId: "yourSecretValueHere"
clientSecret: "yourSecretValueHere"
```
## MariaDB
When initialising databases, users and credentials the Chart expects `.sql` files inside the secret to mount and feed them to the database client.
The expected format for the databases is as follows:
```yaml
stringData:
init-db-open-xchange.sql: |
CREATE DATABASE IF NOT EXISTS openxchange_dummy;
GRANT ALL PRIVILEGES ON openxchange_dummy.* TO "openxchange_user"@"%";
FLUSH PRIVILEGES;
init-db-nextcloud.sql: |
CREATE DATABASE IF NOT EXISTS nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO "nextcloud_user"@"%";
FLUSH PRIVILEGES;
init-db-xwiki.sql: |
CREATE DATABASE IF NOT EXISTS xwiki;
GRANT ALL PRIVILEGES ON xwiki.* TO "xwiki_user"@"%";
FLUSH PRIVILEGES;
```
For the user and credentials the following format is expected:
```yaml
stringData:
init-user-open-xchange.sql: |
CREATE USER IF NOT EXISTS "openxchange_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.openxchangeUser | quote }};
ALTER USER "openxchange_user"@"%" WITH MAX_USER_CONNECTIONS 100;
ALTER USER "openxchange_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.openxchangeUser | quote }};
init-user-nextcloud.sql: |
CREATE USER IF NOT EXISTS "nextcloud_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.nextcloudUser | quote }};
ALTER USER "nextcloud_user"@"%" WITH MAX_USER_CONNECTIONS 100;
ALTER USER "nextcloud_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.nextcloudUser | quote }};
init-user-xwiki.sql: |
CREATE USER IF NOT EXISTS "xwiki_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.xwikiUser | quote }};
ALTER USER "xwiki_user"@"%" WITH MAX_USER_CONNECTIONS 100;
ALTER USER "xwiki_user"@"%" IDENTIFIED BY {{ .Values.secrets.mariadb.xwikiUser | quote }};
```
## MinIO