Repository navigation
Conversation
…isting Secret postgresql.auth.existingSecret and redis.auth.existingSecret (with existingSecretKey) point the built-in databases, the API and the backup job at a Secret the chart does not render. Installs rendered with helm template (GitOps tools such as Argo CD or Kargo) then keep no password in values or in the rendered output, and the Redis password no longer depends on lookup. DATABASE_URL carries no password in that case; postgres.js and pg_dump read PGPASSWORD. Default rendering is unchanged.
This branch has not been deployed
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.
Summary
The built-in Postgres and Redis can't currently be used from a GitOps tool that renders the chart with
helm template(Argo CD, Kargo, Flux with post-rendering):postgresql.auth.passwordhas to be set in values, so the password ends up in Git or in the rendered manifests.randAlphaNumand kept stable withlookup.lookupreturns nothing without a cluster, so every render produces a new password and the API and Redis drift apart.This adds
postgresql.auth.existingSecretandredis.auth.existingSecret(each with anexistingSecretKey). When set, the chart renders no password Secret of its own and points every consumer at the given Secret. Values and rendered output then hold no password. Default rendering is unchanged.Changes
values.yaml
postgresql.auth.existingSecret/existingSecretKey(default keyPOSTGRES_PASSWORD)redis.auth.existingSecret/existingSecretKey(default keyREDIS_PASSWORD)Templates
_helpers.tpl:optio.postgresPasswordSecretandoptio.redisPasswordSecretgive the Secret name/key (existing or chart-rendered).optio.pgPasswordEnvadds aPGPASSWORDenv from the existing Secret. WithexistingSecret,optio.databaseUrlbuilds the URL without a password.postgres.yaml,redis-tls.yaml: skip the chart's own credentials/auth Secret whenexistingSecretis set. The servers read the password through the helpers.api-deployment.yaml:REDIS_PASSWORDthrough the helper.PGPASSWORDadded when Postgres usesexistingSecret.backup-cronjob.yaml:PGPASSWORDon the container that runspg_dump.secrets.yaml: the "password required" check acceptsexistingSecretin place ofpassword.No API changes are needed. The API already injects
REDIS_PASSWORDinto the Redis URL (services/redis-config.ts). postgres.js falls back toPGPASSWORDwhen the URL has no password, and so doespg_dump(libpq).PGPASSWORDisn't added whenexistingSecrets.DATABASE_URLis set, since a user-supplied URL carries its own credentials.Docs:
AGENTS.mdHelm Chart section.Testing
New
scripts/chart-existing-secrets.test.mjs(picked up by CI'snode --test scripts/*.test.mjs; skipped whenhelmis missing) renders the chart and checks:DATABASE_URL, noPGPASSWORDexistingSecret: no password Secrets,DATABASE_URLwithout a passwordPGPASSWORDwhenDATABASE_URLcomes fromexistingSecretsDefault render (TLS off) is byte-identical to
main.The individual
check:pushsteps pass: lint, knip, prettier, typecheck,check-infra.sh, affected unit tests.pnpm check:pushpasses. I couldn't run it as a whole on Windows:scripts/check-push.mjsspawnspnpmwithout a shell, which fails withspawn pnpm ENOENT, so I ran its steps by hand. shellcheck, hadolint and kubeconform weren't installed locally, and I didn't run the e2e suites. I'm leaving those to CI.Related