You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Extension and tablespace volume names can collide with each other and with system volumes #9972
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:
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.
Extensions vs tablespaces: an extension and a tablespace sharing the same name would produce identical volume names.
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.
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.
Activity
dosubot commentedon Feb 12, 2026
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 usingconvertPostgresIDToK8sName(also replacing underscores with hyphens and lowercasing), but neither uses a namespace prefix, so collisions are possible—for example, an extension or tablespace namedpgdata,pg-wal, orshmwould 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-andtbs-) 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.
fix: prefix extension volume names to avoid collisions
fix: prefix extension volume names to avoid collisions
gbartolini commentedon Feb 12, 2026
Good catch Marco
fix: prefix extension volume names to avoid collisions
fix: prefix extension and tablespace volume names to avoid collisions (…
fix: prefix extension and tablespace volume names to avoid collisions (…
fix: prefix extension and tablespace volume names to avoid collisions (…