Skip to content

Handle non-empty EmptyDirs used by GCS Fuse CSI Driver. #11728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

Handle non-empty EmptyDirs used by GCS Fuse CSI Driver.

Some CSI drivers, like GCS Fuse CSI driver, inject EmptyDirs into sidecar
containers and communicate with the container using files in the EmptyDir.

In gVisor terminology, such an EmptyDir is being used as a shared bind (gofer)
mount. It is not exclusive to the sandbox. This breaks a fundamental assumption
gVisor makes about EmptyDirs; it assumes that they are exclusive to the sandbox
and that it has no external observers. So as an optimization, gVisor converts
EmptyDir volumes into gVisor-internal tmpfs filesystems that are mounted into
all the containers that are using that EmptyDir. As a result:

  • Any files in the host EmptyDir directory is not reflected within the sandbox.
  • Any changes made by the sandbox in the EmptyDir are not reflcted on the host.

This change uses the heuristic that if the EmptyDir volume's host directory is
not empty at sandbox creation time, then it is being shared with some external
component which is interacting with the sandbox. We have observed that the GCS
Fuse CSI Driver populates the /gcsfuse-tmp EmptyDir with a UDS at path
.volumes/gcsfuse-mount/socket.

Some CSI drivers, like GCS Fuse CSI driver, inject EmptyDirs into sidecar
containers and communicate with the container using files in the EmptyDir.

In gVisor terminology, such an EmptyDir is being used as a shared bind (gofer)
mount. It is not exclusive to the sandbox. This breaks a fundamental assumption
gVisor makes about EmptyDirs; it assumes that they are exclusive to the sandbox
and that it has no external observers. So as an optimization, gVisor converts
EmptyDir volumes into gVisor-internal tmpfs filesystems that are mounted into
all the containers that are using that EmptyDir. As a result:
- Any files in the host EmptyDir directory is not reflected within the sandbox.
- Any changes made by the sandbox in the EmptyDir are not reflcted on the host.

This change uses the heuristic that if the EmptyDir volume's host directory is
not empty at sandbox creation time, then it is being shared with some external
component which is interacting with the sandbox. We have observed that the GCS
Fuse CSI Driver populates the /gcsfuse-tmp EmptyDir with a UDS at path
`.volumes/gcsfuse-mount/socket`.

PiperOrigin-RevId: 758765841
@copybara-service copybara-service bot added the exported Issue was exported automatically label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exported Issue was exported automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant