Skip to content

use chroot/umount/pivotroot instead of jailing#2091

Merged
djeebus merged 91 commits intomainfrom
mount-namespace
Mar 19, 2026
Merged

use chroot/umount/pivotroot instead of jailing#2091
djeebus merged 91 commits intomainfrom
mount-namespace

Conversation

@djeebus
Copy link
Contributor

@djeebus djeebus commented Mar 10, 2026

Tasks remaining:

  • Resolve race condition (sandbox can't init before adding to map, can't add to map until it's init'd)

Follow up tasks:

  • Enable tracing/logging per connection via feature flag
  • Use LifecycleID to track sandbox volume mounts rather than SandboxID

Note

Medium Risk
Introduces new mount-namespace + pivot_root chroot implementation and changes NFS mount behavior, which can break volume isolation/mount reliability or require elevated privileges in production. Also expands IaC/env configurability, increasing risk of misconfiguration at deploy time.

Overview
Switches the orchestrator’s volume filesystem isolation to a new internal/chrooted implementation that uses a dedicated mount namespace plus mount/pivot_root/umount, and adds a small builder to derive per-team/per-volume paths from PERSISTENT_VOLUME_MOUNTS. The orchestrator config now includes NFS proxy logging/tracing/level env vars (with custom parsing for nfs.LogLevel), envd now waits for all NFS mounts to complete and uses more resilient mount options, and the Terraform/Nomad job wiring is extended to pass arbitrary extra env vars and to make GCP persistent volume types support custom NFS mount options and optional performance (IOPS) config; multiple Go modules also get dependency bumps and mockery generation is moved into the orchestrator package.

Written by Cursor Bugbot for commit efdf97b. This will update automatically on new commits. Configure here.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bce20caf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@dobrac dobrac left a comment

Choose a reason for hiding this comment

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

Have you considered using library for at least some parts of the functionality?

(I suppose Kubernetes ecosystem could have pretty good ones)

@ValentaTomas ValentaTomas requested review from arkamar and removed request for ValentaTomas and arkamar March 12, 2026 02:16
@djeebus djeebus requested a review from dobrac March 19, 2026 01:15
Copy link
Contributor

@dobrac dobrac left a comment

Choose a reason for hiding this comment

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

Small nits, gtg!

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Unused nfs_mount_options variable in persistent-volume-types module
    • Removed the unused nfs_mount_options input from the module call and deleted its unreferenced variable declaration from the module.

Create PR

Or push these changes by commenting:

@cursor push dc2268a65b
Preview (dc2268a65b)
diff --git a/iac/provider-gcp/persistent-volume-types/variables.tf b/iac/provider-gcp/persistent-volume-types/variables.tf
--- a/iac/provider-gcp/persistent-volume-types/variables.tf
+++ b/iac/provider-gcp/persistent-volume-types/variables.tf
@@ -44,8 +44,3 @@
   })
   default = null
 }
-
-variable "nfs_mount_options" {
-  type    = list(string)
-  default = []
-}

diff --git a/iac/provider-gcp/persistent-volumes.tf b/iac/provider-gcp/persistent-volumes.tf
--- a/iac/provider-gcp/persistent-volumes.tf
+++ b/iac/provider-gcp/persistent-volumes.tf
@@ -9,7 +9,6 @@
   location           = each.value.location
   network_name       = var.network_name
   nfs_version        = each.value.nfs_version
-  nfs_mount_options  = each.value.mount_options
   prefix             = var.prefix
   tier               = each.value.tier
   performance_config = each.value.performance_config

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@djeebus djeebus merged commit dbafa25 into main Mar 19, 2026
36 checks passed
@djeebus djeebus deleted the mount-namespace branch March 19, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants