Skip to content

feat(extensions): skip image extension paths missing from the image - #11652

Merged
leonardoce merged 7 commits into
mainfrom
dev/11650
Oct 16, 2026
Merged

leonardoce merged 7 commits into
mainfrom
dev/11650

Conversation

@armru

@armru armru commented Oct 13, 2026

Copy link
Copy Markdown
Member

Image extensions contributed their directories to extension_control_path and dynamic_library_path unconditionally, so an image shipping only lib still added a share entry pointing to a non-existent directory. This made the effective configuration misleading and relied on PostgreSQL silently ignoring missing entries.

The instance manager now adds a directory only when it exists in the mounted image volume. This applies to both the default share and lib directories and to custom paths. Image volumes cannot change during the life of a Pod, so the generated configuration stays stable.

Closes #11650

@armru
armru requested a review from a team as a code owner October 13, 2026 15:55
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.28 release-1.30 labels Oct 13, 2026
@github-actions

Copy link
Copy Markdown
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

@gbartolini
gbartolini force-pushed the dev/11650 branch 2 times, most recently from 54977a8 to f408442 Compare October 14, 2026 16:39
@gbartolini

Copy link
Copy Markdown
Contributor

I tested it with the previous example and I correctly got:

$ kubectl cnpg psql pgvector
psql (18.6 (Debian 18.6-1.pgdg13+2))
Type "help" for help.

postgres=# show extension_control_path;
       extension_control_path
------------------------------------
 $system:/extensions/pgvector/share
 (1 row)

postgres=# show dynamic_library_path;
                           dynamic_library_path
---------------------------------------------------------------------------
 $libdir:/extensions/pgvector/lib:/extensions/keycloak-oauth-validator/lib
(1 row)

Given that this is a Postgres module, the extension_control_path GUC does not include it like before.

@leonardoce

Copy link
Copy Markdown
Contributor

/test

@github-actions

Copy link
Copy Markdown
Contributor

@armru

armru commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

/test

@github-actions

Copy link
Copy Markdown
Contributor

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Oct 15, 2026
armru and others added 7 commits October 16, 2026 11:01
Image extensions contributed their directories to
`extension_control_path` and `dynamic_library_path` unconditionally, so
an image shipping only `lib` still added a `share` entry pointing to a
non-existent directory. This made the effective configuration
misleading and relied on PostgreSQL silently ignoring missing entries.

The instance manager now adds a directory only when it exists in the
mounted image volume. This applies to both the default `share` and `lib`
directories and to custom paths. Image volumes cannot change during the
life of a Pod, so the generated configuration stays stable.

Closes #11650

Signed-off-by: Armando Ruocco <[email protected]>
…ance manager

The existence check lived in `pkg/postgres`, a pure configuration builder
that otherwise never touches the filesystem, and it treated every `stat`
error as a missing directory.

Resolve the `extension_control_path` and `dynamic_library_path` entries in
`pkg/utils/extensions`, next to the `LD_LIBRARY_PATH` and `PATH` ones, and
check their existence in the instance manager, which owns the mounts.
A path below a file counts as missing, while any other error now fails the
configuration refresh instead of being ignored.

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Gabriele Bartolini <[email protected]>
Signed-off-by: Leonardo Cecchi <[email protected]>
…ed images

Skipping the extension directories missing from the image made the
configuration hash depend on the Pod's filesystem. When an extension is
added to an existing Cluster, the Pods that don't mount its image yet
report a different hash from the rolled out ones, and the rolling update
waits forever for every Pod to load the same configuration.

Compute the hash on the directories requested by the Cluster, and remove
the missing ones only from the file written in the Pod. Image volumes are
immutable for the life of a Pod, so the file still changes only when the
hash does.

Signed-off-by: Armando Ruocco <[email protected]>
@leonardoce
leonardoce merged commit e8420dd into main Oct 16, 2026
@leonardoce
leonardoce deleted the dev/11650 branch October 16, 2026 09:11
cnpg-bot pushed a commit that referenced this pull request Oct 16, 2026
…11652)

Image extensions contributed their directories to
`extension_control_path` and `dynamic_library_path` unconditionally, so
an image shipping only `lib` still added a `share` entry pointing to a
non-existent directory. This made the effective configuration misleading
and relied on PostgreSQL silently ignoring missing entries.

The instance manager now adds a directory only when it exists in the
mounted image volume. This applies to both the default `share` and `lib`
directories and to custom paths. Image volumes cannot change during the
life of a Pod, so the generated configuration stays stable.

Closes #11650

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Gabriele Bartolini <[email protected]>
Signed-off-by: Leonardo Cecchi <[email protected]>
Co-authored-by: Gabriele Bartolini <[email protected]>
Co-authored-by: Leonardo Cecchi <[email protected]>
(cherry picked from commit e8420dd)
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 ok to merge 👌 This PR can be merged release-1.30

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Only add image extension paths to Postgres GUCs when the directory exists

4 participants