Skip to content

Conversation

@charith-competa
Copy link
Collaborator

Problem
univention-ldapsearch fails in Kubernetes pods with read-only root filesystems because it cannot create temporary files in /tmp. The script uses mktemp to create temporary files, but when the root filesystem is read-only (common in Kubernetes security contexts), /tmp is also read-only, causing the script to fail with errors like "cannot create tempfile".

Solution
This fix mounts an emptyDir volume to /tmp in all LDAP server deployments (primary, secondary, and proxy). This follows the standard Kubernetes pattern for handling temporary files in read-only container environments. The emptyDir volume provides a writable temporary directory that persists for the pod's lifetime.

Changes
Added tmp-volume emptyDir mount to /tmp in statefulset-primary.yaml
Added tmp-volume emptyDir mount to /tmp in statefulset-secondary.yaml
Added tmp-volume emptyDir mount to /tmp in deployment-proxy.yaml
Testing
Verified templates render correctly with the tmp-volume mount
Tested container environment with read-only rootfs and tmpfs mount to /tmp
Confirmed mktemp works correctly in the mounted /tmp directory
All tests pass
Related
Bug: 58707

univention-ldapsearch fails in Kubernetes pods with read-only root
filesystems because it cannot create temporary files in /tmp. This fix
mounts an emptyDir volume to /tmp in all LDAP server deployments,
ensuring the directory is writable even when the root filesystem is
read-only.

Bug: 58707
@charith-competa charith-competa marked this pull request as ready for review November 21, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants