Skip to content

feat(chart): support existingSecret for DB credentials (Doppler / External Secrets / Vault compatible) - #172

Open
danielqb wants to merge 1 commit into
eftechcombr:mainfrom
danielqb:feat/existing-secret-support
Open

feat(chart): support existingSecret for DB credentials (Doppler / External Secrets / Vault compatible)#172
danielqb wants to merge 1 commit into
eftechcombr:mainfrom
danielqb:feat/existing-secret-support

Conversation

@danielqb

Copy link
Copy Markdown

Problem

MariaDB and GLPI database credentials were only configurable as plaintext
values in values.yaml (mariadb.auth.rootPassword/username/password, etc),
always rendered into chart-managed Secrets. There was no way to point the
chart at a Secret already populated by an external secrets manager
(Doppler, External Secrets Operator, Vault, Sealed Secrets, etc), which
is the standard pattern the Bitnami charts support via
'.auth.existingSecret'.

Fix

Added two independent existingSecret overrides, following the Bitnami
naming convention:

  • mariadb.auth.existingSecret: for the MariaDB server's own credentials
    (needs MARIADB_ROOT_PASSWORD, MARIADB_DATABASE, MARIADB_USER,
    MARIADB_PASSWORD). Used by the MariaDB StatefulSet and the
    mariadb-timezone Job. When set, mariadb-secret.yaml is skipped.

  • glpi.database.existingSecret: for the GLPI application's DB credentials
    (needs MARIADB_DATABASE, MARIADB_USER, MARIADB_PASSWORD - no root
    password, preserving the existing least-privilege separation between
    the app-facing secret and the DB-server-facing secret). Used by
    php-fpm, all 5 init Jobs, and the cronjob. When set, glpi-secret.yaml
    is skipped. Applies whether mariadb.enabled is true or false.

Added glpi.mariadbSecretName / glpi.databaseSecretName helpers in
_helpers.tpl that resolve to the existingSecret name when set, or the
chart-managed Secret name otherwise. All secretRef consumers now go
through these helpers instead of hardcoding mariadb-glpi-secret /
glpi-secret.

Testing

  • helm lint: 0 failures
  • helm template (default): both glpi-secret and mariadb-glpi-secret created
  • helm template --set mariadb.auth.existingSecret=doppler-mariadb-creds:
    mariadb-glpi-secret NOT created; StatefulSet + timezone Job reference
    doppler-mariadb-creds
  • helm template --set glpi.database.existingSecret=doppler-glpi-db-creds:
    glpi-secret NOT created; all 8 consumers (php-fpm, nginx, 5 jobs,
    cronjob) reference doppler-glpi-db-creds

…ernal Secrets / Vault compatible)

## Problem

MariaDB and GLPI database credentials were only configurable as plaintext
values in values.yaml (mariadb.auth.rootPassword/username/password, etc),
always rendered into chart-managed Secrets. There was no way to point the
chart at a Secret already populated by an external secrets manager
(Doppler, External Secrets Operator, Vault, Sealed Secrets, etc), which
is the standard pattern the Bitnami charts support via
'<component>.auth.existingSecret'.

## Fix

Added two independent existingSecret overrides, following the Bitnami
naming convention:

- mariadb.auth.existingSecret: for the MariaDB server's own credentials
  (needs MARIADB_ROOT_PASSWORD, MARIADB_DATABASE, MARIADB_USER,
  MARIADB_PASSWORD). Used by the MariaDB StatefulSet and the
  mariadb-timezone Job. When set, mariadb-secret.yaml is skipped.

- glpi.database.existingSecret: for the GLPI application's DB credentials
  (needs MARIADB_DATABASE, MARIADB_USER, MARIADB_PASSWORD - no root
  password, preserving the existing least-privilege separation between
  the app-facing secret and the DB-server-facing secret). Used by
  php-fpm, all 5 init Jobs, and the cronjob. When set, glpi-secret.yaml
  is skipped. Applies whether mariadb.enabled is true or false.

Added glpi.mariadbSecretName / glpi.databaseSecretName helpers in
_helpers.tpl that resolve to the existingSecret name when set, or the
chart-managed Secret name otherwise. All secretRef consumers now go
through these helpers instead of hardcoding mariadb-glpi-secret /
glpi-secret.

## Testing

- helm lint: 0 failures
- helm template (default): both glpi-secret and mariadb-glpi-secret created
- helm template --set mariadb.auth.existingSecret=doppler-mariadb-creds:
  mariadb-glpi-secret NOT created; StatefulSet + timezone Job reference
  doppler-mariadb-creds
- helm template --set glpi.database.existingSecret=doppler-glpi-db-creds:
  glpi-secret NOT created; all 8 consumers (php-fpm, nginx, 5 jobs,
  cronjob) reference doppler-glpi-db-creds

@eduardofraga eduardofraga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Move files from kubernetes/glpi to helm/
  2. Remove mariadb files and use sub-chart from helmforge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants