Skip to content

Allow passing all database details via ConfigMap/Secret #857

@wingsofovnia

Description

@wingsofovnia

Currently, the chart allow passing database's password from a Secret but not other params like host or username.

Would be great for Helm values to support passing refs to secret/configmaps. Ideally, several syntax options, for example:

    database:
      vendor: postgres
      hostname: 
        configMapKeyRef:
            name: "keycloak-db"
            key: "hostname"
      port: 5432
      database: "my-db"
      username: 
        configMapKeyRef:
            name: "keycloak-db-user"
            key: "username"
      password:
        secretKeyRef:
            name: "keycloak-db-credentials"
            key: "password"

Use Case

I am using cloudnative-pg and db-operator to declaratively define Postgres instance, database and roles for the Keycloak instance. The operators generate a ConfigMap/Secret with connection details.

It will be convenient to just plug those configs into the helm release via helm values.

Workaround

I took inspiration from examples/cloudnative-pg/keycloak-server-values.yaml and provided db connection details from a secret via extraEnv.

⚠️ The example is broken due to dbchecker.enabled: true and unset database.username.

until printf "." && nc -z -w 2 {{ required ".Values.database.hostname is required if dbchecker is enabled!" .Values.database.hostname }} {{ required ".Values.database.port is required if dbchecker is enabled!" .Values.database.port }}; do

So workaround in general works but with limited functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions