Skip to content

feat(persistence): Allow using custom database schema for persistence. Fixes #2452#15897

Open
jnt0r wants to merge 5 commits intoargoproj:mainfrom
jnt0r:feature/persistence-schema
Open

feat(persistence): Allow using custom database schema for persistence. Fixes #2452#15897
jnt0r wants to merge 5 commits intoargoproj:mainfrom
jnt0r:feature/persistence-schema

Conversation

@jnt0r
Copy link
Copy Markdown

@jnt0r jnt0r commented Apr 11, 2026

Fixes #2452

Motivation

Currently, Argo Workflows uses the default database schema for persistence. This PR introduces the ability to configure a custom schema. As MySQL does not have the concept of schemas and used the database name as kind of a schema, it is only introduced to postgres.

Key benefits:

  • Namespace Isolation: Clearly separate Argo Workflows metadata from other tables in the same database.
  • Permissions Management: Allows DBAs to restrict the Argo service user to a specific schema.
  • Flexibility: Supports complex infrastructure setups where the default schema (e.g., public in PostgreSQL) is restricted or reserved for other purposes.

Modifications

  • It is now possible to set the optional "schema" Property in the persistence config for the workflow controller (configmap).
  • The schema is created for postgresql if the schema is set and does not already exist (migration)

Verification

I adjusted the Unit Tests to verify the schema is set to the database connections only when schema is explicitly set. When the schema is not overridden the default schema is used to provide downward compatibility.

Locally tested with hack/db (setting custom dsn like it would be generated in code: -d postgres://postgres:password@host.docker.internal:5432/postgres?search_path=argo)

Also, I created a new integration test with postgres and mysql testcontainers to test the connection is correctly using the new schema.

Should I also create a new E2E test?

Documentation

Added the schema property in examples and added additional chapter to "workflow archive" chapter.

@jnt0r jnt0r force-pushed the feature/persistence-schema branch 5 times, most recently from 9dfc2e1 to 9f08db4 Compare April 12, 2026 18:18
Comment thread docs/workflow-archive.md Outdated

## Customizing PostgreSQL Database Schema

To change the schema for the tables in PostgreSQL, set `schema:` to the desired schema in the `persistence` section of [your configuration](workflow-controller-configmap.yaml). Only available on PostgreSQL.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Each sentence on a new line please. It make future reviews easier. Thanks!

@jnt0r jnt0r force-pushed the feature/persistence-schema branch 5 times, most recently from 2b19b4c to 4909fae Compare April 14, 2026 18:46
…ql database

Signed-off-by: Jonathan Pollert <jona.pollert@gmail.com>
@jnt0r jnt0r force-pushed the feature/persistence-schema branch from 4909fae to 3ce2a72 Compare April 14, 2026 19:18
@jnt0r jnt0r marked this pull request as ready for review April 15, 2026 08:10
@jnt0r jnt0r requested a review from tico24 April 15, 2026 19:07
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.

Custom db schema for persistence tables

2 participants