Repository navigation
fix(runtimes): mount Flux shared-memory volume as writable - #4205
nikhil3495 wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
6e9dfa8 to
92f2d7d
Compare
abhishekKokadwar
left a comment
There was a problem hiding this comment.
Thanks @nikhil3495. I think this is right, and I ran it to check rather than go on reading alone.
Opinion
The volume is a memory-backed emptyDir mounted at /dev/shm so MPI jobs get more shared memory than the container runtime default. Mounted read-only it cannot do that job, so dropping WithReadOnly(true) is the correct fix. Leaving the config map and curve secret mounts read-only is also right.
What I ran
Unit tests, at 92f2d7d:
| Result | |
|---|---|
PR code with PR test, go test ./pkg/runtime/framework/plugins/flux/ |
ok |
flux.go from master with the PR test |
FAIL: TestFlux, diff shows ReadOnly: &true where nil is expected |
So the updated expectation does pin the change.
Behaviour in a cluster. The issue says MPI workloads "will likely fail", so I checked what the mount actually does. In kind (Kubernetes v1.36.1), one Pod with a medium: Memory emptyDir named shared-memory, mounted at /dev/shm the way the plugin does it, plus a container with no volume for comparison:
| Container | /proc/mounts |
Size | echo x > /dev/shm/probe |
|---|---|---|---|
readOnly: true (master today) |
tmpfs /dev/shm tmpfs ro,... |
1.9G | Read-only file system |
no readOnly (this PR) |
tmpfs /dev/shm tmpfs rw,... |
1.9G | succeeds |
| no volume at all | shm |
64M | succeeds |
Two things follow. The read-only mount is confirmed to reject writes. And the current behaviour is worse than not having the volume: without it a container still gets a writable 64M /dev/shm, with it the container gets none it can write to. That is a stronger case than the issue makes, and it might be worth adding to the description.
What I did not test
I did not run a Flux TrainJob or an MPI workload, so I have not seen a real job fail on master or pass with this change. The check above covers the mount semantics only. The branch is 21 commits behind master, but GitHub reports it as mergeable and the Flux plugin tests pass on it as is.
One question
The read-only flag came in with #3325. I could not find a reason for it in that PR. If someone who knows the Flux plugin can confirm it was not deliberate, I see nothing else to hold this.
/lgtm
|
Thanks for testing this in a cluster — that confirms the fix is |
|
@andreyvelich: GitHub didn't allow me to assign the following users: vsoch. Note that only kubeflow members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Thanks for the context. Could you share the reason why ReadOnly should |
|
Done — removed the ReadOnly field from the FluxMemoryVolumeName assertion at line 2460 in trainjob_controller_test.go to match the fix in flux.go. |
|
New changes are detected. LGTM label has been removed. |
|
Thanks @vsoch for the context, and for catching the integration test expectation. I only ran the Flux plugin unit tests in my earlier check and missed that assertion. I checked |
|
/ok-to-test |
|
Thank you for confirming the fix and for catching the integration |
|
@nikhil3495 the Go unit and integration tests pass now, including the updated assertion. The E2E jobs failed before any test ran: master moved to Go 1.27 in #4217, and this branch is still on 1.26 ( |
The /dev/shm emptyDir volume in the Flux plugin was mounted with ReadOnly: true, which prevents any write to the shared-memory filesystem and defeats the purpose of the volume. Remove the WithReadOnly(true) call from the FluxMemoryVolumeName VolumeMount so the mount is writable, matching the intent of the volume and the standard use of /dev/shm in MPI workloads. Signed-off-by: Nikhil Bansiwal <nikhilbansiwal3495@gmail.com>
…ount The integration test at line 2460 still asserted ReadOnly: true for the FluxMemoryVolumeName mount. Remove the field to match the fix in flux.go and flux_test.go, as confirmed by vsoch in the PR review. Signed-off-by: Nikhil Bansiwal <nikhilbansiwal3495@gmail.com>
c8a70b5 to
6d8af25
Compare
What this PR does / why we need it:
The Flux plugin mounts its memory-backed
emptyDirvolume(
FluxMemoryVolumeName) at/dev/shmwithReadOnly: true. That volume wasadded in #3325 so MPI jobs get the host's shared memory instead of the
container runtime's 64M default. A read-only mount prevents any process from
writing to
/dev/shm, which defeats that purpose.This PR removes
.WithReadOnly(true)from theFluxMemoryVolumeNameVolumeMount in
EnforceMLPolicy, so the mount is writable. The config-mapand curve-secret mounts remain read-only.
The expected mount in
TestFluxis updated to match. The test fails on theunfixed code, where the diff shows
ReadOnly: &trueonshared-memory, andpasses with the fix.
Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...format, will close the issue(s) when PR gets merged):Fixes #4204
Checklist:
Not applicable: no user-facing docs change.