Skip to content

Support existing secret for the full external DB connection - #2382

Open
tada5hi wants to merge 1 commit into
goharbor:mainfrom
tada5hi:support-existing-secret-external-db
Open

Support existing secret for the full external DB connection#2382
tada5hi wants to merge 1 commit into
goharbor:mainfrom
tada5hi:support-existing-secret-external-db

Conversation

@tada5hi

@tada5hi tada5hi commented Jun 29, 2026

Copy link
Copy Markdown

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 to password); host, port, username and coreDatabase must be plaintext values. This PR turns existingSecret into an object so the whole connection can come from one secret, with configurable key names:

database:
  external:
    existingSecret:
      enabled: false
      name: "my-external-secret-name"
      keys:
        host: host
        port: port
        username: username
        password: password
        coreDatabase: dbName
  • When enabled: true: core (deployment + pre-upgrade job) and exporter source POSTGRESQL_HOST/PORT/USERNAME/PASSWORD/DATABASE from the referenced secret via secretKeyRef, and core-cm / core-secret / exporter-cm-env / exporter-secret skip emitting the plaintext values.
  • When enabled: false: behaviour is unchanged (backward compatible).

Testing

  • helm lint → 0 failed.
  • helm template with database.type=external and database.external.existingSecret.enabled=true renders all five connection variables from the referenced secret on both core and exporter; with it disabled, the rendered output matches main.

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>
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.

Support sourcing the full external DB connection from an existing secret

1 participant