Skip to content

Render external database connection values with tpl - #2384

Open
tada5hi wants to merge 1 commit into
goharbor:mainfrom
tada5hi:feat/tpl-external-db-values
Open

Render external database connection values with tpl#2384
tada5hi wants to merge 1 commit into
goharbor:mainfrom
tada5hi:feat/tpl-external-db-values

Conversation

@tada5hi

@tada5hi tada5hi commented Jun 29, 2026

Copy link
Copy Markdown

Closes #2383.

What

The external DB connection values (database.external.host, port, username, coreDatabase, sslmode) are emitted verbatim by the harbor.database.* helpers, so they cannot contain template expressions. This wraps the external branch of those helpers in tpl:

{{- tpl (.Values.database.external.host | toString) $ -}}

so values may reference the release context, e.g.:

database:
  external:
    host: "{{ .Release.Name }}-postgresql-primary"

The password helper is intentionally left untouched.

Why

Lets a parent/umbrella chart point Harbor at a release-scoped database service without hardcoding the release name — enabling multiple installs in one namespace.

Compatibility

A value with no template syntax renders unchanged, so this is fully backward compatible.

Testing

  • helm lint → 0 failed.
  • helm template with database.type=external:
    • host: "{{ .Release.Name }}-postgresql-primary"POSTGRESQL_HOST: "myrel-postgresql-primary"
    • plain host: "db.example.com"POSTGRESQL_HOST: "db.example.com" (unchanged)

Wrap database.external.{host,port,username,coreDatabase,sslmode} in `tpl` so
they may contain template expressions, e.g. host: "{{ .Release.Name }}-postgresql".
Values without template syntax are returned unchanged, so this is fully backward
compatible. The password is intentionally left untouched.

This lets a parent/umbrella chart point Harbor at a release-scoped database
service without hardcoding the release name, enabling multiple installs in one
namespace.

Signed-off-by: tada5hi <peter.placzek1996@gmail.com>
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.

Render external database connection values with tpl (release-name-based host)

1 participant