feat: add native PostgreSQL backend and external plugin architecture#621
Open
maelanjais wants to merge 13 commits into
Open
feat: add native PostgreSQL backend and external plugin architecture#621maelanjais wants to merge 13 commits into
maelanjais wants to merge 13 commits into
Conversation
… for external backends
…CI pipeline with postgres integration test
…I, remove broken CI workflow
…nt-driven updates
- Restore configSources/shouldApplyTOML/AfterApply for proper CLI > env > TOML precedence resolution (was lost when postgres/plugin backends were added) - Add applyBackendDefaults() and move per-backend node defaults out of Run() to match upstream pattern; add postgres to the defaults switch - Add Database and PluginPath fields to TOMLConfig so they are configurable via confd.toml - Restore TestLoadConfigFile_ExplicitDefaultSourcesOverrideTOML and TestApplyBackendDefaults test coverage - Bump Go from 1.25.8 to 1.26 / toolchain go1.26.2 in go.mod - Update Go version pins to 1.26.3 in all GitHub Actions workflows, Dockerfile.build, and .tool-versions - Restore v0.41.2 section to CHANGELOG (was absent due to rebase on older base) - Rewrite README.md to match upstream format while documenting the new PostgreSQL (with LISTEN/NOTIFY watch) and Plugin backends - Promote hashicorp/go-plugin to a direct dependency in go.mod (go mod tidy)
Owner
|
@maelanjais thanks for the contribution! I would be ok with adding PostgreSQL as a backend, but I'm not sure how much value it would actually bring. Could you minimally split these two features into their own PRs so that the can be assessed independently? |
This was referenced Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two new backend types to confd:
Native PostgreSQL backend (
postgres) powered bypgx/v5, with real-time change notification viaLISTEN/NOTIFY(eliminating polling in watch mode), support for SQL Views to map confd keys to existing businesstables, and standard username/password authentication.
External plugin backend (
plugin) using HashiCorp go-plugin, allowing operators to load any custom backend at runtime as a standalone binary without recompiling confd. Areference implementation (
cmd/confd-plugin-postgres) ships as a PostgreSQL plugin example.Changes
New packages
pkg/backends/postgres/— PostgreSQLStoreClientwithGetValues(prefix scan viaLIKE) andWatchPrefix(dedicatedLISTEN confd_updateconnection)pkg/backends/plugin/— go-plugin client that launches an external binary and proxiesStoreClientcalls over RPCpkg/backends/plugin/api/— shared RPC DTOs,BackendProviderinterface,BackendRPCClient/BackendRPCServer, andConfdBackendPluginboilerplatecmd/confd-plugin-postgres/— reference PostgreSQL plugin binary (demonstrates the plugin SDK)CLI additions
confd postgressubcommand (--node,--username,--password,--database,--table)confd pluginsubcommand (--plugin-path)pkg/backends/client.goandpkg/backends/config.goConfig file support
databaseandplugin_pathfields added toTOMLConfigso both backends can be configured fromconfd.tomlTests
pkg/backends/postgres/client_test.go)pkg/backends/plugin/api/api_test.go)Documentation
PLUGIN_ARCHITECTURE.md— plugin SDK specification and implementation guidePLUGIN_DEMO.md— end-to-end demo with Docker ComposePOSTGRES_DEMO.md— PostgreSQL setup, SQL Views, LISTEN/NOTIFY walkthroughREADME.mdupdated to list the two new backends in the feature list and backend tableTest plan
go test ./...passes (all 26 packages)make buildsucceedsgo build ./cmd/confd-plugin-postgressucceedsTestLoadConfigFile_ExplicitDefaultSourcesOverrideTOMLPOSTGRES_DEMO.md)confd-plugin-postgresand a running Postgres instance (seePLUGIN_DEMO.md)