Skip to content

feat(extensions): support underscores in extension names#9386

Merged
mnencia merged 4 commits intocloudnative-pg:mainfrom
shusaan:fix/extension-underscore-cluster-failure
Feb 4, 2026
Merged

feat(extensions): support underscores in extension names#9386
mnencia merged 4 commits intocloudnative-pg:mainfrom
shusaan:fix/extension-underscore-cluster-failure

Conversation

@shusaan
Copy link
Contributor

@shusaan shusaan commented Dec 9, 2025

Allow PostgreSQL extension names to contain underscores (e.g., pg_ivm, pg_stat_statements) to support standard PostgreSQL extension naming conventions that were previously rejected by CRD validation.

Extension names with underscores are automatically sanitized to use hyphens for Kubernetes volume names (to comply with RFC 1123 DNS label requirements) while preserving the original name in mount paths. Webhook validation prevents naming conflicts after sanitization (e.g., pg_ivm and pg-ivm both become pg-ivm).

Closes #9383

@shusaan shusaan requested a review from a team as a code owner December 9, 2025 08:13
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 9, 2025
@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 Dec 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

❗ 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

@dosubot dosubot bot added the bug 🐛 Something isn't working label Dec 9, 2025
@shusaan shusaan force-pushed the fix/extension-underscore-cluster-failure branch from 08601c1 to 506271f Compare December 9, 2025 08:16
@armru
Copy link
Member

armru commented Dec 9, 2025

/test

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

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

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Dec 9, 2025
@NiccoloFei NiccoloFei force-pushed the fix/extension-underscore-cluster-failure branch 2 times, most recently from 3124782 to 2ba0e4e Compare February 2, 2026 14:24
@NiccoloFei NiccoloFei requested a review from jsilvela as a code owner February 2, 2026 14:48
@NiccoloFei NiccoloFei force-pushed the fix/extension-underscore-cluster-failure branch from 2cc26e0 to 0274881 Compare February 3, 2026 11:34
@NiccoloFei
Copy link
Collaborator

/test ft=image-volume-extensions

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

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

@NiccoloFei
Copy link
Collaborator

/test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

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

@armru armru force-pushed the fix/extension-underscore-cluster-failure branch from 0274881 to 2d8ac67 Compare February 3, 2026 14:48
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 3, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 3, 2026
@armru armru changed the title Fix: Support PostgreSQL extensions with underscores in names fix(cluster): Support PostgreSQL extensions with underscores in names Feb 3, 2026
@armru armru changed the title fix(cluster): Support PostgreSQL extensions with underscores in names fix(cluster): support PostgreSQL extensions with underscores in names Feb 3, 2026
@armru armru changed the title fix(cluster): support PostgreSQL extensions with underscores in names fix(cluster): support extensions with underscores in names Feb 3, 2026
@armru armru changed the title fix(cluster): support extensions with underscores in names fix(extensions): support underscores in PostgreSQL extension names Feb 3, 2026
@armru armru changed the title fix(extensions): support underscores in PostgreSQL extension names fix(extensions): support underscores in extension names Feb 3, 2026
@mnencia mnencia force-pushed the fix/extension-underscore-cluster-failure branch from 2d8ac67 to e98d302 Compare February 4, 2026 09:27
@mnencia mnencia changed the title fix(extensions): support underscores in extension names feat(extensions): support underscores in extension names Feb 4, 2026
@mnencia mnencia force-pushed the fix/extension-underscore-cluster-failure branch 2 times, most recently from 455c904 to ba2d25d Compare February 4, 2026 10:44
@mnencia
Copy link
Member

mnencia commented Feb 4, 2026

/test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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

shusaan and others added 4 commits February 4, 2026 14:27
…olume names

- Update extension name validation pattern to allow underscores in addition to hyphens
- Add sanitizeExtensionNameForVolume function to convert underscores to hyphens for Kubernetes volume names
- Apply sanitization to extension volume names & mount to comply with RFC 1123 DNS label requirements
- Add test cases to verify underscore sanitization in volume names and mount paths
- Update CRD schema to reflect new validation pattern allowing underscores

Signed-off-by: Husn E Rabbi <shussan@gmail.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
…lisions

Add validation to detect when two extension names would result in the same
Kubernetes volume name after underscore-to-hyphen sanitization (e.g., pg_ivm
and pg-ivm both become pg-ivm), which would cause Kubernetes API errors.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Extension names now must start and end with alphanumeric characters,
preventing invalid patterns like leading or trailing underscores.
Webhook validation no longer reports redundant errors when duplicate
names also cause sanitized volume name collisions.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
@mnencia mnencia force-pushed the fix/extension-underscore-cluster-failure branch from ba2d25d to c690319 Compare February 4, 2026 13:27
@mnencia mnencia merged commit 85fa0c5 into cloudnative-pg:main Feb 4, 2026
24 of 27 checks passed
cnpg-bot pushed a commit that referenced this pull request Feb 4, 2026
Allow PostgreSQL extension names to contain underscores (e.g., pg_ivm,
pg_stat_statements) to support standard PostgreSQL extension naming
conventions that were previously rejected by CRD validation.

Extension names with underscores are automatically sanitized to use
hyphens for Kubernetes volume names (to comply with RFC 1123 DNS label
requirements) while preserving the original name in mount paths. Webhook
validation prevents naming conflicts after sanitization (e.g., pg_ivm
and pg-ivm both become pg-ivm).

Closes #9383

Signed-off-by: Husn E Rabbi <shussan@gmail.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
(cherry picked from commit 85fa0c5)
mnencia added a commit that referenced this pull request Feb 4, 2026
Allow PostgreSQL extension names to contain underscores (e.g., pg_ivm,
pg_stat_statements) to support standard PostgreSQL extension naming
conventions that were previously rejected by CRD validation.

Extension names with underscores are automatically sanitized to use
hyphens for Kubernetes volume names (to comply with RFC 1123 DNS label
requirements) while preserving the original name in mount paths. Webhook
validation prevents naming conflicts after sanitization (e.g., pg_ivm
and pg-ivm both become pg-ivm).

Closes #9383

Signed-off-by: Husn E Rabbi <shussan@gmail.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
(cherry picked from commit 85fa0c5)
(cherry picked from commit a0ddd0a)
mnencia added a commit that referenced this pull request Feb 4, 2026
Add two missing enhancements that were backported to release-1.28:
- PR #9468: Azure DefaultAzureCredential authentication support
- PR #9386: PostgreSQL extension names with underscores support

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases bug 🐛 Something isn't working lgtm This PR has been approved by a maintainer ok to merge 👌 This PR can be merged release-1.27 release-1.28 size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: PostgreSQL Extension Names with Underscores Fail to Create Clusters

6 participants