feat: add hf-mount-sidecar binary for CSI sidecar injection#86
Draft
feat: add hf-mount-sidecar binary for CSI sidecar injection#86
Conversation
POSIX Compliance (pjdfstest) |
Benchmark Results |
34220cc to
9a4bc01
Compare
Allow running the FUSE daemon on a pre-opened /dev/fuse file descriptor received via SCM_RIGHTS from the CSI driver. The CSI driver (privileged) does the kernel mount, the sidecar (unprivileged) serves FUSE requests. - --fuse-fd flag on hf-mount-fuse binary - MountOptions::default_for_sidecar() for programmatic construction - Disable clone_fd when using from_fd (sidecar has no /dev/fuse access)
Self-contained binary that runs as a native sidecar (KEP-753): - Discovers mount configs in shared emptyDir - Connects to CSI driver's Unix socket, receives FUSE fd via SCM_RIGHTS - Runs hf-mount FUSE daemon in-process with Session::from_fd() - Reads HF token from config for private repo authentication All sidecar logic is contained in the binary (no lib.rs pollution). Dockerfile builds both hf-mount-fuse and hf-mount-sidecar.
- Return OwnedFd from connect_and_receive_fd (prevents fd leak on panic) - Propagate OwnedFd through mount_fuse instead of raw i32 - Replace glob crate with std::fs::read_dir (simpler, no extra dep) - Add revision field to MountConfig (honors CSI driver volume attributes) - Make wait_for_socket return Result instead of silently continuing
9a4bc01 to
0971d17
Compare
- Install ctrlc handler so SIGTERM/SIGINT during wait_for_configs exits cleanly instead of hanging until timeout - Replace default_for_sidecar() with Default impl on MountOptions (new fields get a compile error only if they lack a Default value, which is easier to maintain)
- Replace stringly-typed source_type with SourceType enum (catches invalid values at deserialization instead of runtime match) - Add warn logging when config.json fails to parse (was silently skipped) - Add stabilization check in config discovery to avoid missing late-arriving configs when CSI driver writes them non-atomically
The CSI driver now writes a plain args file (one flag per line) using the same CLI syntax as hf-mount-fuse. The sidecar parses it with the shared Args struct, eliminating MountConfig, SourceType, and the MountOptionsWrapper. This ensures the sidecar supports every flag that hf-mount-fuse supports with zero additional maintenance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Native Rust sidecar mounter for the HF CSI driver's unprivileged sidecar injection mode.
New files
src/sidecar.rs: discover mount configs in shared emptyDir, receive FUSE fd via SCM_RIGHTSsrc/bin/hf-mount-sidecar.rs: entry point that polls for configs, receives fd, runs FUSE daemon in-processKey changes
src/fuse.rs:Session::from_fd()support, disableclone_fdin sidecar mode (sidecar has no /dev/fuse access)src/setup.rs:MountOptions::default_for_sidecar()for programmatic constructionMountConfig.token: HF token passed via config.json from the CSI driver for private repo authenticationhf-mount-fuseandhf-mount-sidecarHow it works
The sidecar is fully unprivileged: no root, no /dev/fuse, no CAP_SYS_ADMIN.
Companion PR: huggingface/hf-csi-driver#19