Skip to content

feat(customfuse): add generic FUSE driver for RunC and sandbox scenarios#1722

Open
AlbeeSo wants to merge 17 commits into
kubernetes-sigs:masterfrom
AlbeeSo:feat/common-fuse
Open

feat(customfuse): add generic FUSE driver for RunC and sandbox scenarios#1722
AlbeeSo wants to merge 17 commits into
kubernetes-sigs:masterfrom
AlbeeSo:feat/common-fuse

Conversation

@AlbeeSo

@AlbeeSo AlbeeSo commented Jun 15, 2026

Copy link
Copy Markdown
Member

What type of PR is this?

/feature

What this PR does / why we need it:

Summary

This PR introduces the customfuse CSI driver, a generic framework for running any FUSE client as a managed pod in both RunC container and sandbox scenarios. Users supply the FUSE client image and entrypoint script; the driver handles pod lifecycle, mount propagation, and credential injection.

Key Changes

1. Generic FUSE Driver Architecture

  • Supports any FUSE client (JuiceFS, s3fs, JindoFS, etc.) via configurable image + entrypoint
  • Configuration flows from PV volumeAttributes + Secret into entrypoint.sh as env vars
  • Optional ConfigMap-injected entrypoint for iterating mount logic without image rebuilds

2. Sandbox Support

  • Add --mount-proxy-sock and --customfuse-mount-proxy-sock CLI flags as default mount-proxy socket paths for csi-agent mode
  • SKIP_GLOBAL_MOUNT env var to skip globalmount and mount directly to target path
  • csi-agent integration via customfuse.NewCSIAgent()

Examples: JuiceFS CE + Alibaba Cloud OSS

Four demo patterns showing different configuration approaches:

Demo Description
1-baked-in All config hardcoded in image ENV
2-standard Config from PV volumeAttributes + Secret (recommended)
3-advanced-entrypoint Custom resource controls: cache quota, credential cleanup
4-configmap Entrypoint via ConfigMap — iterate without image rebuild

Each demo includes Dockerfile, entrypoint.sh, and PV/PVC/Secret YAML.

The README also includes quick-reference snippets for adapting to other FUSE clients (s3fs, JindoFS).

New CLI Flags

Flag Scope Purpose
--mount-proxy-sock csi-agent / OSS / NAS / BMCPFS Default mount-proxy socket path (fallback when no ControllerPublish)
--customfuse-mount-proxy-sock csi-agent / customfuse Default mount-proxy socket path (fallback when no ControllerPublish)

Breaking Changes

None. customfuse is a new driver and does not affect existing OSS/NAS/BMCPFS drivers.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AlbeeSo
Once this PR has been reviewed and has the lgtm label, please assign mowangdk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot requested review from huww98 and mowangdk June 15, 2026 07:24
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 15, 2026
@AlbeeSo AlbeeSo force-pushed the feat/common-fuse branch from 49de836 to 319f9ef Compare June 15, 2026 07:32
@AlbeeSo AlbeeSo marked this pull request as draft June 15, 2026 09:23
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2026
@AlbeeSo AlbeeSo force-pushed the feat/common-fuse branch from 76c8326 to b67a7db Compare June 15, 2026 10:04
@AlbeeSo AlbeeSo marked this pull request as ready for review June 15, 2026 12:10
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2026
Comment thread deploy/charts/alibaba-cloud-csi-driver/templates/controller.yaml Outdated

# Stage 2: assemble the final image on top of the FUSE client.
# TODO: replace with actual JuiceFS image tag
FROM juicedata/mount:ce-v1.2.0

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.

Can we obtain this image from our CI/CD environment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's available in dockerHub.

Comment thread pkg/mounter/utils/utils.go
@AlbeeSo AlbeeSo force-pushed the feat/common-fuse branch from b67a7db to d7cbd60 Compare June 16, 2026 02:48
AlbeeSo added 15 commits June 16, 2026 15:16
The mount result type is used by all FUSE drivers (ossfs, ossfs2, customfuse), not just ossfs. Rename to reflect its generic nature.
Add customfuse bool parameter to GetFuseAttachDir, GetAttachPath, and GetMountProxySocketPath so customfuse volumes use /run/fuse.customfuse instead of /run/fuse.ossfs. All existing oss callers pass false.
…package

Move ShouldConstrainResourceVersion from oss/registry to the parent fuse_pod_manager package so customfuse can reuse it. Add EntrypointConfig fields to FusePodContext for ConfigMap-based entrypoint injection. Reject customfuse fuseType in oss checkOssOptions.
Implements FuseMounterType for customfuse pods. Reads per-mount image from csi-plugin ConfigMap (key fuse-{fuseType}), supports ConfigMap-based entrypoint injection, and uses /var/run/customfuse for metrics.
Mount proxy server driver for customfuse. Uses entrypoint script pattern (ConfigMap or default), passes mount params as env vars, integrates with MonitorInterceptor for mount point health monitoring.
Add CSI driver implementation for custom FUSE filesystems (JuiceFS, Jindo, etc.). Includes controller server with fuse pod lifecycle, node server with RunC/sandbox mount paths, options parsing, and csi-agent support.
…rfile

Register customfuse driver in main binary and csi-agent dispatch. Add customfuse metrics collection (fuse_stat collector). Add customfuse-base stage to mount-proxy Dockerfile.
Add CSIDriver object, controller sidecars (provisioner + attacher), plugin volume mounts, node-driver-registrar, and fuse namespace support for customfuse. Disabled by default (csi.customfuse.enabled).
…ndbox scenarios

Add --mount-proxy-sock and --customfuse-mount-proxy-sock flags to configure mount-proxy socket paths for sandbox agent scenarios.
Support SKIP_GLOBAL_MOUNT env to skip customfuse globalMount in csi-plugin.
Bucket is now a first-class field in fuseOptions, passed through to the entrypoint as  env var independently of source and url. The source fallback (bucket:path) is preserved for backward compatibility.
Use a single-resource informer to watch the csi-plugin ConfigMap, eliminating per-mount API calls that cause pressure under batch mounts. The informer is only started in controller mode; node-only instances skip it entirely.
Add 4 JuiceFS CE demos (baked-in, standard, advanced-entrypoint, configmap) and a comprehensive README covering architecture, env var mapping, image resolution, Dockerfile structure, and quick references for s3fs and JindoFS.
- Add otherOpts validation in all entrypoints to prevent command injection (validate each argument starts with --)
- Reframe cache-size cap from "OOM prevention" to "cache quota (QoS)" to reflect that this is resource governance for multi-tenant scenarios
- Update README.md to document the validation requirement
@AlbeeSo AlbeeSo force-pushed the feat/common-fuse branch from d7cbd60 to fc0621b Compare June 16, 2026 09:25
@AlbeeSo AlbeeSo marked this pull request as draft June 17, 2026 03:18
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 17, 2026
…rehensive README

- Rename example dirs: 2-standard → 2-oss-compatible, 3-advanced-entrypoint → 3-standard
- Rewrite README.md with quick start guide, debugging, operations, config reference, and s3fs/JindoFS adaptation examples
- Decouple bucket as independent volumeAttribute option in controller/nodeserver
- Add input validation (otherOpts) in all entrypoints to prevent command injection
- Replace single configmap.yaml with environment-specific variants development/production)
- Add comprehensive unit tests for new options parsing
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AlbeeSo
Once this PR has been reviewed and has the lgtm label, please assign mowangdk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

- Add Capacity field to fuseOptions, passed as  to entrypoint
- Plain integers pass through directly; values with units (e.g. 100Gi) are validated as Kubernetes Quantity and passed through as-is
- Entrypoint is responsible for unit conversion (framework is client-agnostic)
- Add CustomFuseAutoCapacity feature gate (Alpha, default off): controller reads pv.spec.capacity.storage and passes it via PublishContext
- Extract resolveAutoCapacity from ControllerPublishVolume with unit tests
- Refactor parseOptions to accept publishRequest interface, move PublishContext→volContext capacity merge logic inside
- JuiceFS demo entrypoints: set quota before mount (metadata-only op, no unmounted window), use exec for foreground mount
@AlbeeSo AlbeeSo marked this pull request as ready for review June 25, 2026 02:07
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2026
@kubernetes-prow kubernetes-prow Bot requested a review from mowangdk June 25, 2026 02:07
@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 6, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants