Skip to content

fix(trainer): detect OpenShift pip permission error and document work…#46

Merged
google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
priyank766:feat/openshift-pip-fix
Jul 18, 2026
Merged

fix(trainer): detect OpenShift pip permission error and document work…#46
google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
priyank766:feat/openshift-pip-fix

Conversation

@priyank766

@priyank766 priyank766 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

fix(trainer): detect OpenShift pip permission error and document workaround

Problem

fixes : #41
On OpenShift clusters with a restricted Security Context Constraint (SCC), the root filesystem is read-only. Running run_custom_training(packages=[...]) executes pip install --user (writing to /.local), which fails with a PermissionError: [Errno 13] Permission denied: '/.local' because user-defined volumes are not mounted during the pre-script installation step.

Changes

  • Log Parser (kubeflow_mcp/trainer/api/monitoring.py): Added an OpenShift-specific pattern to _FAILURE_PATTERNS to catch permission errors on /.local and return the workaround suggestion.
  • Agent Instructions (kubeflow_mcp/trainer/__init__.py): Added prompt guidance under INSTRUCTION_SECTIONS["training"] advising AI agents to avoid the packages parameter on OpenShift.
  • Documentation (kubeflow_mcp/trainer/resources/platform-fixes.md): Documented the issue and the target-directory workaround.
  • Tests (tests/unit/trainer/test_monitoring.py): Added a new test suite to verify the parser correctly matches and prioritizes the OpenShift error over generic permission errors.

Workaround

Do not use the packages parameter on OpenShift. Instead, run the installation within the training script using:

import subprocess, sys, os
lib_dir = '/workspace/lib'
os.makedirs(lib_dir, exist_ok=True)
subprocess.run([sys.executable, '-m', 'pip', 'install', '--target', lib_dir, '--quiet', 'transformers', 'peft', 'trl'], check=True)
sys.path.insert(0, lib_dir)

Verification

  • All 147 unit tests pass.
  • Ruff checks and formatting pass with zero violations.

Copilot AI review requested due to automatic review settings June 25, 2026 11:15
@github-actions

Copy link
Copy Markdown

🎉 Welcome to the Kubeflow MCP Server! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards
  • Our team will review your PR soon! cc @kubeflow/kubeflow-sdk-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@abhijeet-dhumal

Copy link
Copy Markdown
Member

/lgtm

OpenShift pip permission detection is exactly what we need. Consider consolidating with #47 if both touch the same error path.

@google-oss-prow google-oss-prow Bot added the lgtm Looks good to me — approved by a reviewer label Jul 10, 2026
@abhijeet-dhumal

Copy link
Copy Markdown
Member

/ok-to-test

@google-oss-prow google-oss-prow Bot added the ok-to-test Approve CI for external contributors label Jul 18, 2026
@priyank766
priyank766 force-pushed the feat/openshift-pip-fix branch from d087685 to 40af07f Compare July 18, 2026 13:57
@google-oss-prow google-oss-prow Bot removed the lgtm Looks good to me — approved by a reviewer label Jul 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyank766 One doc nit: the detection table + "/.local emptyDir fixes most pip issues" still send agents to emptyDir for Permission denied on /.local, but new version says the packages= pre-script never gets those mounts.
Can you split that case in the table (runtime writes to emptyDir; packages= to /workspace/lib workaround) so agents don't mis-route?
WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah Makes sense. I've split the error cases in both platform-fixes.md and troubleshooting.md to separate runtime write issues from the packages pre-script limitation.
@abhijeet-dhumal

…around

Signed-off-by: priyank <priyank8445@gmail.com>
@priyank766
priyank766 force-pushed the feat/openshift-pip-fix branch from 40af07f to 5b1f5bb Compare July 18, 2026 14:08
@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Jul 18, 2026
@abhijeet-dhumal

Copy link
Copy Markdown
Member

/lgtm
/approve
Thanks @priyank766 for your contribution, this is great work 🚀

@google-oss-prow google-oss-prow Bot added the lgtm Looks good to me — approved by a reviewer label Jul 18, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhijeet-dhumal

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot added the approved Approved by an approver in OWNERS label Jul 18, 2026
@google-oss-prow
google-oss-prow Bot merged commit 70aeb1f into kubeflow:main Jul 18, 2026
12 of 13 checks passed
@google-oss-prow google-oss-prow Bot added this to the v0.1 milestone Jul 18, 2026
@priyank766
priyank766 deleted the feat/openshift-pip-fix branch July 18, 2026 14:22
reckless-sherixx added a commit to reckless-sherixx/mcp-server that referenced this pull request Jul 19, 2026
…RROR (kubeflow#46 covers it), add comprehensive HF tests

Signed-off-by: Vidyansh <ezboi2312@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved by an approver in OWNERS lgtm Looks good to me — approved by a reviewer ok-to-test Approve CI for external contributors size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run_custom_training packages parameter fails on OpenShift (read-only /.local)

3 participants