Skip to content

feat: support pgdog.toml from an existing Secret (configSecret) - #128

Merged
levkk merged 2 commits into
pgdogdev:mainfrom
mscrivo:feat/config-secret
Aug 12, 2026
Merged

feat: support pgdog.toml from an existing Secret (configSecret)#128
levkk merged 2 commits into
pgdogdev:mainfrom
mscrivo:feat/config-secret

Conversation

@mscrivo

@mscrivo mscrivo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation

We run pgdog against databases whose hosts and admin credentials live in AWS Secrets Manager, rendered into a complete pgdog.toml by External Secrets Operator. That file can't go through chart values — it would put credentials into the ConfigMap — and overlaying it on the chart's copy with a subPath volume mount fails at container start with not a directory: the mount target /etc/pgdog/pgdog.toml is a symlink inside the ConfigMap volume, and container runtimes refuse to bind a file over it (kubernetes/kubernetes#61545). As published, there's no working way to feed the chart a Secret-sourced pgdog.toml.

What this does

Adds a configSecret value mirroring the existing usersSecret pattern:

configSecret:
  name: my-pgdog-config # existing Secret in the same namespace
  key: pgdog.toml       # remapped to pgdog.toml if named differently

When configSecret.name is set:

  • the config volume is sourced from that Secret instead of the chart's ConfigMap (custom key remapped to pgdog.toml, same as usersSecret)
  • the chart's pgdog.toml ConfigMap is not rendered (same treatment usersSecret gives the users Secret)

All parameters optional; default rendering is unchanged.

Notes

  • plugins[].config entries render into the chart ConfigMap, so they aren't mounted when configSecret.name is set. Documented in values.yaml and the README; a Secret-provided pgdog.toml controls its own plugin config paths, so plugin files can be mounted via extraVolumes.
  • Test coverage added: test/values-existing-config-secret.yaml plus assertions in test/test.sh that the volume source swaps, the key is remapped, and the ConfigMap is suppressed. ./test/test.sh passes.

🤖 Generated with Claude Code

Add a configSecret value mirroring usersSecret: when configSecret.name is
set, the config volume is sourced from that existing Secret (with the key
remapped to pgdog.toml) instead of the chart-rendered ConfigMap, which is
then skipped entirely.

This makes it possible to run pgdog when pgdog.toml contains values that
must not live in a ConfigMap, e.g. database hosts and the admin password
rendered from a secrets manager (External Secrets, sealed-secrets, SOPS).
Overlaying such a file on top of the chart's ConfigMap with a subPath
volume mount is not an option: the mount target is a symlink inside the
ConfigMap volume and container runtimes reject the mount at pod start
(kubernetes/kubernetes#61545), so swapping the volume source is the only
way to provide the whole file.

All parameters optional; default rendering is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread test/test.sh Outdated
exit 1
fi

# Validate configSecret swaps the config volume source and skips the ConfigMap

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this, claude keeps trying to add tests here, but this is not how we want this repo to be tested imo.

If you add a yaml into test directory, it will be automatically rendered and checked for validity (with helm).

@levkk levkk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mscrivo
mscrivo marked this pull request as ready for review August 12, 2026 19:20
@levkk
levkk merged commit 3a13248 into pgdogdev:main Aug 12, 2026
3 of 4 checks passed
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.

2 participants