feat(postgres): Support multiple PostgreSQL operator secret formats.

feat(postgres): Support multiple PostgreSQL operator secret formats.

Rework the DSN construction in clientOptions.newFromProto to support secrets produced by a variety of PostgreSQL operators. Presets are shipped for CNPG, Crunchy Data, and Zalando; users can also supply a custom field projection via PostgreSQLSecret.Projection.

Each DSN field is resolved either from inline config (Host, Port, DatabaseName, Username) or from a secret field looked up via the projection. Password is always resolved from a secret. Errors across all fields are joined so callers see every misconfiguration at once, not just the first.

As defense in depth, resolveSecret rejects secret references containing a slash to prevent path traversal into other secret namespaces. The schema already constrains secret names to valid Kubernetes resource names.

Depends on the matching Fairway schema change in gitlab-com/gl-infra/platform/runway/fairway!63 (merged), which introduces PostgreSQLSecret, PostgreSQLFormat, and PostgreSQLProjection and turns PostgreSQL.Host into a *string. The go.mod entry points at a pre-release commit until that MR is merged and tagged.

Issue: #108, gitlab-com/gl-infra/platform/runway/team#873 (closed)

Edited by Florian Forster

Merge request reports

Loading
Loading