Render external database connection values with tpl - #2384
Open
tada5hi wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2383.
What
The external DB connection values (
database.external.host,port,username,coreDatabase,sslmode) are emitted verbatim by theharbor.database.*helpers, so they cannot contain template expressions. This wraps the external branch of those helpers intpl:so values may reference the release context, e.g.:
The
passwordhelper 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 templatewithdatabase.type=external:host: "{{ .Release.Name }}-postgresql-primary"→POSTGRESQL_HOST: "myrel-postgresql-primary"host: "db.example.com"→POSTGRESQL_HOST: "db.example.com"(unchanged)