Skip to content

Fix MDS crash when securityContext sets a different runAsUser#382

Merged
N-o-Z merged 2 commits intomasterfrom
fix/mds-pythonpath-workaround
Feb 25, 2026
Merged

Fix MDS crash when securityContext sets a different runAsUser#382
N-o-Z merged 2 commits intomasterfrom
fix/mds-pythonpath-workaround

Conversation

@N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Feb 25, 2026

Closes #381

Summary

  • The MDS Docker image (treeverse/mds) installs Python packages with pip install --user into /home/arktika/.local/lib/python3.13/site-packages/
  • When the Helm chart's securityContext sets a different runAsUser, Python resolves the user site-packages directory relative to the new user's home, where no packages exist
  • This causes ModuleNotFoundError: No module named 'pyarrow' at container startup
  • Workaround: Set PYTHONPATH env var in the MDS deployment to explicitly include the arktika user's site-packages path
  • TODO in code: The proper fix is to rebuild the MDS image with packages installed globally (pip install without --user)

How to reproduce

# Works (default user arktika, UID 1000):
docker run --rm --entrypoint python treeverse/mds:0.2.1 -c "import pyarrow"

# Fails (different UID, simulating securityContext.runAsUser):
docker run --rm --user 1001 --entrypoint python treeverse/mds:0.2.1 -c "import pyarrow"
# ModuleNotFoundError: No module named 'pyarrow'

Test plan

  • Deploy the chart with mds.enabled=true and a securityContext.runAsUser different from 1000
  • Verify the MDS pod starts successfully and imports complete without errors

🤖 Generated with Claude Code

N-o-Z and others added 2 commits February 25, 2026 15:26
The MDS Docker image installs Python packages under the arktika user's
home directory (~/.local/lib/python3.13/site-packages). When the Helm
chart's securityContext configures a different runAsUser, Python resolves
the user site-packages to a different home directory where no packages
exist, causing "ModuleNotFoundError: No module named 'pyarrow'" at startup.

Add PYTHONPATH env var pointing to the arktika user's site-packages as a
workaround. The proper fix is to rebuild the MDS image with globally
installed packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@N-o-Z N-o-Z self-assigned this Feb 25, 2026
@N-o-Z N-o-Z requested a review from a team February 25, 2026 20:31
@N-o-Z N-o-Z merged commit 669941c into master Feb 25, 2026
4 checks passed
@N-o-Z N-o-Z deleted the fix/mds-pythonpath-workaround branch February 25, 2026 20:32
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.

MDS Broken deployment

2 participants