feat: add PostgreSQL support for manager database - #492
Conversation
2724a79 to
2b295ff
Compare
2b295ff to
3f749b2
Compare
|
Could a maintainer please add the |
de58eab to
e48a722
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Dragonfly Helm chart to support configuring the manager database as external PostgreSQL (in addition to the existing MySQL configuration), and adds a chart value to allow injecting extra init containers into the manager Deployment.
Changes:
- Add
externalPostgresconfiguration tovalues.yamland document it inREADME.md. - Update
manager-configmap.yamlto renderdatabase.typeand a PostgreSQL config block when enabled. - Update
manager-deployment.yamlto supportmanager.extraInitContainersand to introduce aconfig-renderedvolume path for PostgreSQL mode.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| charts/dragonfly/values.yaml | Adds manager.extraInitContainers and new externalPostgres values. |
| charts/dragonfly/templates/manager/manager-deployment.yaml | Allows extra init containers; switches manager config mount to config-rendered and adds an emptyDir volume in PostgreSQL mode. |
| charts/dragonfly/templates/manager/manager-configmap.yaml | Adds PostgreSQL database configuration rendering and database.type. |
| charts/dragonfly/README.md | Documents externalPostgres values and manager.extraInitContainers. |
| charts/dragonfly/Chart.yaml | Bumps chart version and updates Artifact Hub changelog annotations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e48a722 to
4261217
Compare
|
I have this already deployed and running. Please let me know if you find any problem! |
4ee1cd4 to
94741f7
Compare
The Dragonfly manager application has supported PostgreSQL since dragonflyoss/dragonfly#1459, but the Helm chart only renders MySQL configuration in the manager configmap. This adds: - externalPostgres values section (host, port, database, sslMode, etc.) - database.type field in the configmap (postgres or mysql) - database.postgres block when externalPostgres is enabled; mysql block only rendered when postgres is disabled - manager.extraInitContainers support for custom init containers (e.g. to inject database credentials from a Kubernetes Secret at pod startup) - config-rendered emptyDir volume and conditional mount swap when externalPostgres is enabled, allowing init containers to write the final config without duplicate mountPath conflicts - Example extraInitContainers in values.yaml showing credential injection When externalPostgres.enable is true, database.type is set to postgres and the manager uses the postgres config block. Signed-off-by: Jamal Allogie <jamal.allogie@gmail.com> Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
Addresses Copilot review feedback: when externalPostgres.enable was
true but no extraInitContainers were provided, the manager mounted an
empty config-rendered emptyDir and started without its config file.
Add a dedicated manager.renderConfig flag (default: false) that
controls the config-rendered mount swap, rather than gating on
externalPostgres.enable or manager.extraInitContainers:
- Gating on externalPostgres.enable breaks the simple path where a
user enables external postgres with static credentials in
values.yaml and expects the ConfigMap to be mounted directly.
- Gating on extraInitContainers couples the mount swap to an
unrelated escape hatch — users who add an extraInitContainers
for non-config-rendering reasons (wait-for-X, custom migrations,
etc.) would silently get an empty config dir.
With manager.renderConfig:
- Default (false): the manager always mounts the ConfigMap directly,
extraInitContainers stays a pure escape hatch with no volume side
effects. Static credentials in values.yaml work out of the box
for both externalPostgres and externalMysql.
- Opt-in (true): the manager mounts a config-rendered emptyDir and
the user's extraInitContainers is expected to populate
/etc/dragonfly/manager.yaml (e.g. by substituting credentials
from a Kubernetes Secret into the raw ConfigMap).
Signed-off-by: Jamal Allogie <jamal.allogie@gmail.com>
Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
Updated comments for extra init containers and external PostgreSQL configuration. Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
Updated comments for clarity regarding Kubernetes Secret usage. Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
748a592 to
92699e2
Compare
Signed-off-by: Jamal Allogie <jamal.allogie@deepl.com>
|
Will this be merged soon? |
|
Thanks for the PR! Could you also add existingSecret field so d7y directly reads from the K8s secret instead of using init container? cc: @gaius-qi @jim3ma @chlins @yxxhero @Liam-Zhao for review |
|
@bumarcell Please resolve conflicts. |
|
@tz-torchai the initContainer is needed to decide where to pull the creds from, based on the config. |
I see, the cleaner fix would be an app-side PR adding AutomaticEnv() so existingSecret could work via plain |
Summary
The Dragonfly manager application has supported PostgreSQL since dragonflyoss/dragonfly#1459, but the Helm chart only renders MySQL configuration. This adds PostgreSQL support to the chart.
Changes
values.yamlexternalPostgressection:enable,host,port,database,username,password,sslMode,timezone,migratemanager.extraInitContainers: []— generic escape hatch for additional init containersmanager.renderConfig: false— opt-in flag that swaps the/etc/dragonflymount from the raw ConfigMap to an emptyDir, so a user-supplied init container can render the finalmanager.yaml(e.g. by substituting credentials pulled from a Kubernetes Secret)externalPostgressection showing how to combinerenderConfig: true+ an init container to inject credentials from a Secretmanager-configmap.yamldatabase.typefield (postgreswhen enabled,mysqlotherwise)database.postgresblock whenexternalPostgres.enableis truemysqlblock only rendered when postgres is disabledmanager-deployment.yamlmanager.extraInitContainerssupport viacommon.tplvalues.rendermanager.renderConfigis true, mounts aconfig-renderedemptyDir at/etc/dragonflyinstead of the raw ConfigMap, and declares that emptyDir volume. The user'sextraInitContainersentry is expected to read the raw ConfigMap (from anextraVolumeMountspath) and write the renderedmanager.yamlto/etc/dragonfly/manager.yaml.renderConfig: false): manager mounts the ConfigMap directly,extraInitContainersstays a pure escape hatch with no volume side effects — static credentials invalues.yamlwork out of the box for bothexternalPostgresandexternalMysql.Usage
Direct credentials
Credentials from Kubernetes Secret
Follow-up
A more ergonomic
externalPostgres.existingSecretpattern (chart-shipped init container that does the substitution automatically) is a natural follow-up and will land in a separate PR once this one merges. That avoids bloating this PR further and keeps the review focused on the coreexternalPostgres+renderConfigplumbing.