Skip to content

feat(database): add declarative management of foreign servers#8401

Merged
leonardoce merged 26 commits intocloudnative-pg:mainfrom
EdwinaZhu:issue-8063-declarative-support-for-foreign-server
Sep 18, 2025
Merged

feat(database): add declarative management of foreign servers#8401
leonardoce merged 26 commits intocloudnative-pg:mainfrom
EdwinaZhu:issue-8063-declarative-support-for-foreign-server

Conversation

@EdwinaZhu
Copy link
Contributor

@EdwinaZhu EdwinaZhu commented Aug 20, 2025

Add support for managing PostgreSQL Foreign Data Wrappers (FDWs) with foreign servers declaratively via the spec.servers field in the Database custom resource.

This enables Kubernetes-native, privilege-aware lifecycle management of foreign servers without requiring direct SQL execution or superuser privileges.

Supported configuration includes name, ensure, usage grants/revokes, and options. A foreign data wrapper must already exist.

Only foreign servers explicitly listed in spec.servers are reconciled; others remain untouched. Reconciliation uses PostgreSQL’s native CREATE SERVER, ALTER SERVER, and DROP SERVER commands.

Closes #8063

@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.26 release-1.27 labels Aug 20, 2025
@github-actions
Copy link
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@EdwinaZhu EdwinaZhu force-pushed the issue-8063-declarative-support-for-foreign-server branch from e3214cd to 6695674 Compare August 20, 2025 14:53
@EdwinaZhu EdwinaZhu force-pushed the issue-8063-declarative-support-for-foreign-server branch 2 times, most recently from 5d5bad3 to 48afc4c Compare August 27, 2025 08:32
@EdwinaZhu EdwinaZhu force-pushed the issue-8063-declarative-support-for-foreign-server branch from 48afc4c to 64c9170 Compare September 8, 2025 09:38
@EdwinaZhu EdwinaZhu marked this pull request as ready for review September 8, 2025 09:42
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Sep 8, 2025
@EdwinaZhu EdwinaZhu changed the title Draft: declarative management for Foreign Server Feat: Declarative management for Foreign Server Sep 8, 2025
@dosubot dosubot bot added E2E tests E2E tests tickets for easy triage on release process enhancement 🪄 New feature or request labels Sep 8, 2025
@gbartolini gbartolini added do not backport This PR must not be backported - it will be in the next minor release and removed backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 labels Sep 8, 2025
EdwinaZhu and others added 14 commits September 17, 2025 19:17
Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
… of foreign servers

Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
…WIP)

Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
@mnencia mnencia force-pushed the issue-8063-declarative-support-for-foreign-server branch 2 times, most recently from 9d685ea to 50fb06a Compare September 17, 2025 17:23
@mnencia
Copy link
Member

mnencia commented Sep 17, 2025

/test

@github-actions
Copy link
Contributor

@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/17805595546

@mnencia mnencia force-pushed the issue-8063-declarative-support-for-foreign-server branch from df73505 to 353d04f Compare September 18, 2025 07:52
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
@mnencia mnencia force-pushed the issue-8063-declarative-support-for-foreign-server branch from 353d04f to 07792bc Compare September 18, 2025 07:57
@leonardoce leonardoce merged commit 6f759d0 into cloudnative-pg:main Sep 18, 2025
30 checks passed
rossigee pushed a commit to rossigee/cloudnative-pg that referenced this pull request Oct 2, 2025
…ative-pg#8401)

Add support for managing PostgreSQL Foreign Data Wrappers (FDWs) with
foreign servers declaratively via the `spec.servers` field in the
`Database` custom resource.

This enables Kubernetes-native, privilege-aware lifecycle management of
foreign servers without requiring direct SQL execution or superuser
privileges.

Supported configuration includes `name`, `ensure`, `usage`
grants/revokes, and `options`. A foreign data wrapper must already
exist.

Only foreign servers explicitly listed in `spec.servers` are reconciled;
others remain untouched. Reconciliation uses PostgreSQL’s native `CREATE
SERVER`, `ALTER SERVER`, and `DROP SERVER` commands.

Closes cloudnative-pg#8063

Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
THE-BRAHMA pushed a commit to THE-BRAHMA/cloudnative-pg that referenced this pull request Oct 30, 2025
…ative-pg#8401)

Add support for managing PostgreSQL Foreign Data Wrappers (FDWs) with
foreign servers declaratively via the `spec.servers` field in the
`Database` custom resource.

This enables Kubernetes-native, privilege-aware lifecycle management of
foreign servers without requiring direct SQL execution or superuser
privileges.

Supported configuration includes `name`, `ensure`, `usage`
grants/revokes, and `options`. A foreign data wrapper must already
exist.

Only foreign servers explicitly listed in `spec.servers` are reconciled;
others remain untouched. Reconciliation uses PostgreSQL’s native `CREATE
SERVER`, `ALTER SERVER`, and `DROP SERVER` commands.

Closes cloudnative-pg#8063

Signed-off-by: YingZhu <yingzhu3@andrew.cmu.edu>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: theBrahma <office.utpal.brahma@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not backport This PR must not be backported - it will be in the next minor release E2E tests E2E tests tickets for easy triage on release process enhancement 🪄 New feature or request lgtm This PR has been approved by a maintainer ok to merge 👌 This PR can be merged size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Declarative support for foreign servers

6 participants