Skip to content

feat(worker): let the owner choose runc or gVisor per earner, and report what each host can give - #892

Merged
GeiserX merged 2 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/sec-l1-capabilities
Nov 27, 2026
Merged

GeiserX merged 2 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/sec-l1-capabilities

Conversation

@Amigadelasmigas

@Amigadelasmigas Amigadelasmigas commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Today an owner who wants an earner under gVisor has to set environment variables on the worker. The UI cannot see which runtimes a host has, and it cannot see which runtime each earner got. The UI needs both before it can offer the choice.

This PR adds the worker side:

  • The heartbeat reports system_info.layers. It holds the runtimes that Docker registered, which of them are gVisor (judged by the binary), whether the host has /dev/kvm, the runtime that an env variable pins, and the runtimes that the socket proxy allows. A value the worker cannot read is null, so an older or blind worker reads as unknown, never as absent.
  • Each container entry gets its runtime and network.
  • A deploy spec takes runtime_choice (runc or gvisor), and the worker turns it into a registered runtime. gVisor needs a runtime registered with --network=host. An earner that declares NET_RAW also needs --net-raw. A choice that the worker cannot honour is refused with the reason, and it is never swapped for another runtime.
  • The worker applies the runtime in this order: the catalog's required runtime, then an explicit runtime, then the env pin (bridge networking only), then the owner's choice. So the env variables still win over the UI.

Nothing selects gVisor by itself. With no choice, an earner keeps Docker's default, as before.

Stack: 1 of 4. #893, #894 and #895 build on it.

Desktop: needs nothing. Desktop has no Docker runtimes. Its deploy form and validation do not change here, because the field is optional and the UI never sends it to Desktop.

Tests: tests/test_layers.py has 32 tests. Two mutations turned them red: removing the env pin check gave 5 failures, and so did removing the net_raw filter. Real hosts: through the worker API, on a throwaway Ubuntu 24.04 box, Honeygain with gvisor got runsc-hostnet on cashpilot-isolated. Bitping got runsc-hostnet-raw. A redeploy with runc got runc.

…ort what each host can give

The runtime choice was env-only, so an owner could not pick gVisor for one
earner from the UI, and the UI could not show which earners really got it.

- The heartbeat reports system_info.layers: the runtimes Docker registered and
  which are gVisor (judged by the binary, not the name), KVM from sysfs, and
  what CASHPILOT_CONTAINER_RUNTIME and its overrides pin. Unread values are
  null, so an older or blind worker reads as unknown, not absent.
- Each container entry carries its runtime and network.
- A deploy takes runtime_choice, runc or gvisor. gVisor becomes the
  --network=host variant Docker's DNS needs on our bridge, plus --net-raw for
  an earner whose catalog declares NET_RAW (Bitping).
- A choice that the catalog (Mysterium needs runc) or an env pin overrules is
  refused with the reason before the running container is touched. The env
  still wins over the UI; nothing is swapped silently.
- No choice means Docker's default, as before.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 844f3ed and e64429e.

Files selected for processing: 6

  • Dockerfile.worker
  • app/layers.py
  • app/orchestrator.py
  • app/worker_api.py
  • tests/test_layers.py
  • tests/test_route_at_deploy.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ntime choice that a named runtime or a routed copy cannot honour
@GeiserX
GeiserX merged commit 1b424b5 into GeiserX:main Nov 27, 2026
11 checks passed
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.54545% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.58%. Comparing base (844f3ed) to head (e64429e).
⚠️ Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
app/layers.py 92.85% 8 Missing ⚠️
app/orchestrator.py 97.61% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #892      +/-   ##
==========================================
+ Coverage   94.56%   94.58%   +0.01%     
==========================================
  Files          94       95       +1     
  Lines       28125    28291     +166     
==========================================
+ Hits        26597    26758     +161     
- Misses       1528     1533       +5     
Files with missing lines Coverage Δ
app/worker_api.py 92.35% <100.00%> (+0.05%) ⬆️
app/orchestrator.py 94.75% <97.61%> (+0.02%) ⬆️
app/layers.py 92.85% <92.85%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants