Skip to content

Support PostgreSQL connection secrets - #32

Draft
iplay88keys wants to merge 3 commits into
mainfrom
iplay88keys/postgres-connection-secret
Draft

iplay88keys wants to merge 3 commits into
mainfrom
iplay88keys/postgres-connection-secret

Conversation

@iplay88keys

@iplay88keys iplay88keys commented Sep 4, 2026

Copy link
Copy Markdown

Important

This PR requires a substrate bump after this upstream PR merges: agent-substrate#1752

Summary

  • Add postgres.connectionStringSecretRef so the chart can read the Substrate runtime/DML connection from a Kubernetes Secret instead of placing credentials in a ConfigMap.
  • Add optional postgres.ddlConnectionString and postgres.ddlConnectionStringSecretRef settings for a separate schema-owner connection used by migrations and maintenance.
  • Pass the DDL connection to ateapi through ATE_API_POSTGRES_DDL_CONNECTION_STRING and --postgres-ddl-connection-string=@env.
  • Keep postgres.schema in the existing ConfigMap and default enabled Secret references without a name to the release-scoped <release>-postgres-connection Secret.
  • Reject conflicting inline and Secret-backed settings, a missing external runtime connection, and a DDL connection without an explicit runtime connection.
  • Add Helm unit coverage and run the chart tests in the existing Helm CI workflow.

This lets parent charts provide PostgreSQL credentials through normal Kubernetes Secret references without coupling Substrate to a specific parent chart.

Configuration

The existing single-connection configuration remains supported:

postgres:
  enabled: false
  schema: substrate
  connectionStringSecretRef:
    name: substrate-postgres
    key: connectionString

For separate runtime/DML and DDL roles, both connections can come from the same Secret under different keys:

postgres:
  enabled: false
  schema: substrate
  connectionStringSecretRef:
    name: substrate-postgres
    key: runtimeConnectionString
  ddlConnectionStringSecretRef:
    name: substrate-postgres
    key: ddlConnectionString

When the DDL connection is omitted, ateapi uses the runtime connection for both purposes. With separate roles, the DDL role owns the schema and creates its objects; after migrations, ateapi grants the runtime role the table and sequence permissions it needs. This avoids requiring operators to update grants whenever a migration adds a table.

@iplay88keys
iplay88keys marked this pull request as draft September 4, 2026 19:48
@iplay88keys
iplay88keys marked this pull request as ready for review September 4, 2026 20:24
@iplay88keys
iplay88keys requested a review from EItanya September 4, 2026 21:52
@EItanya
EItanya force-pushed the main branch 3 times, most recently from 971d345 to 007eb1e Compare September 10, 2026 21:46
teemow added a commit to giantswarm/substrate that referenced this pull request Sep 11, 2026
teemow added a commit to giantswarm/substrate that referenced this pull request Sep 11, 2026
teemow added a commit to giantswarm/substrate that referenced this pull request Sep 11, 2026
teemow added a commit to giantswarm/substrate that referenced this pull request Sep 11, 2026
teemow added a commit to giantswarm/substrate that referenced this pull request Sep 11, 2026
…ests; the #8 patches' commits as they are on giantswarm (#11)

The second release of the line, v0.0.27-gs.2 (tag on ef30433 = gs.1 + the
Postgres connection Secret cherry-picks of kagent-dev#32 and the
atelet scheduling knobs, #8), published by run 34554981306 with every scan
clean, gets its ledger row: index digests of the six images, the two chart
digests, the dataplane it runs.

The carried-patches table named the #8 commits by their pull-request
branch SHAs (42c0c6b, 392841e, d9717d7), which the rebase merge rewrote;
the commits on giantswarm are c1e4e32, f06f5ef and 084d916.
@EItanya
EItanya force-pushed the main branch 5 times, most recently from f60e0f3 to 74056c2 Compare September 17, 2026 11:27
Allow ate-api-server to read an external PostgreSQL connection string from a Secret while keeping schema configuration in the existing ConfigMap. Add Helm unit coverage for bundled, literal, Secret-backed, and invalid setups.
@iplay88keys
iplay88keys force-pushed the iplay88keys/postgres-connection-secret branch from 41097da to 38af2c9 Compare September 17, 2026 17:23
@iplay88keys
iplay88keys marked this pull request as draft September 18, 2026 21:52
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.

1 participant