Support existing secret for the full external DB connection - #2382
Open
tada5hi wants to merge 1 commit into
Open
Support existing secret for the full external DB connection#2382tada5hi wants to merge 1 commit into
tada5hi wants to merge 1 commit into
Conversation
Allow every external database connection parameter (host, port, username,
password, coreDatabase) to be sourced from an existing secret, not only the
password. `database.external.existingSecret` becomes an object:
existingSecret:
enabled: false
name: ""
keys:
host: host
port: port
username: username
password: password
coreDatabase: dbName
When enabled, core (deployment + pre-upgrade job) and exporter read the
connection from the referenced secret, and the cm/secret templates skip the
plaintext values; when disabled, behaviour is unchanged.
This revives the change from goharbor#1783 (closed unmerged).
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 #2381.
Revives the change from #1783 (closed unmerged), rebased on current
main.What
Today, with an external database, only the password can be read from
database.external.existingSecret(with the key hardcoded topassword);host,port,usernameandcoreDatabasemust be plaintext values. This PR turnsexistingSecretinto an object so the whole connection can come from one secret, with configurable key names:enabled: true:core(deployment + pre-upgrade job) andexportersourcePOSTGRESQL_HOST/PORT/USERNAME/PASSWORD/DATABASEfrom the referenced secret viasecretKeyRef, andcore-cm/core-secret/exporter-cm-env/exporter-secretskip emitting the plaintext values.enabled: false: behaviour is unchanged (backward compatible).Testing
helm lint→ 0 failed.helm templatewithdatabase.type=externalanddatabase.external.existingSecret.enabled=truerenders all five connection variables from the referenced secret on both core and exporter; with it disabled, the rendered output matchesmain.