Skip to content

[Bug]: Extension and tablespace volume names can collide with each other and with system volumes #9972

Description

@mnencia

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

No response

Version

trunk (main)

What version of Kubernetes are you using?

1.35

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

YAML manifest

What happened?

Extension and tablespace volumes are named using the raw resource name (with underscores replaced by hyphens for extensions via sanitizeExtensionNameForVolume, and via convertPostgresIDToK8sName for tablespaces). This creates three classes of potential volume name collisions:

  1. Extensions or tablespaces vs system volumes: a resource named pgdata, shm, pg-wal, scratch-data, or projected would collide with built-in volume names, causing pod creation to fail.
  2. Extensions vs tablespaces: an extension and a tablespace sharing the same name would produce identical volume names.
  3. Cross-sanitization collisions: e.g. an extension named pg_wal sanitizes to pg-wal, colliding with the WAL volume.

Both extensions and tablespaces should use a namespace prefix for their volume names (e.g. ext- and tbs-) to make all three collision classes structurally impossible.

The fix needs migration logic to avoid unnecessary pod restarts during online upgrades when the volume names change. During a rolling update, the operator should recognize that existing pods with the old naming scheme are functionally equivalent and not force a restart solely for the rename.

Found during review of #9781.

Cluster resource

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added this to the 1.29.0 milestone on Feb 12, 2026
  2. self-assigned this
    on Feb 12, 2026
  3. added theissue type on Feb 12, 2026
  4. dosubot commented on Feb 12, 2026

    @dosubot

    There is currently no existing issue or PR tracking the specific bug where extension and tablespace volume names can collide with each other or with system volumes. The codebase generates extension volume names using sanitizeExtensionNameForVolume (replacing underscores with hyphens) and tablespace volume names using convertPostgresIDToK8sName (also replacing underscores with hyphens and lowercasing), but neither uses a namespace prefix, so collisions are possible—for example, an extension or tablespace named pgdata, pg-wal, or shm would conflict with system volumes, and extension/tablespace names can collide with each other after sanitization. Only extension-extension collisions are currently validated and blocked by webhook logic; there is no similar check for extension/tablespace or system volume collisions.

    There is also no migration logic to treat renamed volumes as equivalent during rolling upgrades. Any change to a volume's name is detected as a PodSpec drift and will force a pod restart, since the rollout logic compares volume names exactly and only ignores a couple of legacy volumes for backward compatibility. This means that introducing namespace prefixes (like ext- and tbs-) would require additional migration handling to avoid unnecessary restarts during upgrades. At present, the only way to avoid these collisions is to manually ensure unique, non-conflicting names for extensions and tablespaces in your cluster spec.

    Namespace prefixing for extension and tablespace volumes, along with migration logic to recognize old and new names as equivalent, would be a robust solution, but it is not implemented yet. If you plan to address this, you'll need to update both the naming logic and the pod spec comparison/rollout logic to support seamless migration without forced restarts.

    References:

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cloudnative-pg with Dosu Add Dosu to your team

  5. added a commit that references this issue on Feb 12, 2026
    eba1804
  6. added a commit that references this issue on Feb 12, 2026
    6d040d4
  7. gbartolini commented on Feb 12, 2026

    @gbartolini
    Contributor

    Good catch Marco

  8. added a commit that references this issue on Feb 20, 2026
    28890a3
  9. added a commit that references this issue on Feb 20, 2026
    8d3af4d
  10. added 2 commits that reference this issue on Feb 20, 2026
    84a2373
    c360ebf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't working

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions