Skip to content

feat(sandbox): inject host gateway hostAliases into sandbox pods#306

Merged
pimlock merged 4 commits intomainfrom
host-gateway-sandbox-aliases/an
Mar 14, 2026
Merged

feat(sandbox): inject host gateway hostAliases into sandbox pods#306
pimlock merged 4 commits intomainfrom
host-gateway-sandbox-aliases/an

Conversation

@drew
Copy link
Collaborator

@drew drew commented Mar 14, 2026

Summary

  • Sandbox pods running in the k3s cluster cannot resolve host.docker.internal by default, preventing them from reaching services on the Docker host (e.g. local provider endpoints during development).
  • Detects the host gateway IP (default route) in the cluster entrypoint script and threads it through the full config pipeline: entrypoint → HelmChart manifest → Helm values → gateway server env → SandboxClient → sandbox pod spec.
  • Injects hostAliases entries (host.docker.internal, host.openshell.internal) into every sandbox pod spec so processes inside sandboxes can resolve the Docker host.
  • The injection is conditional — when the IP is empty (non-Docker deployments), no hostAliases are added.

Changes

File Change
deploy/docker/cluster-entrypoint.sh Detect host gateway IP via ip route; inject into HelmChart via sed
deploy/kube/manifests/openshell-helmchart.yaml Add hostGatewayIP: __HOST_GATEWAY_IP__ placeholder
deploy/helm/openshell/values.yaml Add server.hostGatewayIP default
deploy/helm/openshell/templates/statefulset.yaml Map to OPENSHELL_HOST_GATEWAY_IP env var
crates/openshell-core/src/config.rs Add host_gateway_ip field + builder method
crates/openshell-server/src/main.rs Add CLI arg / env var
crates/openshell-server/src/lib.rs Pass to SandboxClient
crates/openshell-server/src/sandbox/mod.rs Store on SandboxClient; inject hostAliases in both default and custom pod template paths

Test Plan

  • 3 new unit tests added covering: hostAliases injected when IP set, not injected when empty, injected in custom pod templates
  • All 162 existing openshell-server tests pass
  • Full mise run pre-commit passes (format, lint, check, all workspace tests)

@drew drew self-assigned this Mar 14, 2026
Sandbox pods running in the k3s cluster cannot resolve host.docker.internal
by default, preventing them from reaching services on the Docker host.

Detect the host gateway IP (default route) in the cluster entrypoint,
thread it through the Helm chart to the gateway server, and inject
hostAliases entries (host.docker.internal, host.openshell.internal)
into every sandbox pod spec. The injection is conditional -- when the
IP is empty (non-Docker deployments), no hostAliases are added.
@pimlock pimlock force-pushed the host-gateway-sandbox-aliases/an branch from 89fe4a6 to 2846d1a Compare March 14, 2026 22:48
@pimlock pimlock self-requested a review March 14, 2026 23:47
@pimlock pimlock merged commit cdd5978 into main Mar 14, 2026
9 checks passed
@pimlock pimlock deleted the host-gateway-sandbox-aliases/an branch March 14, 2026 23:54
drew added a commit that referenced this pull request Mar 16, 2026
* feat(sandbox): inject host gateway hostAliases into sandbox pods

Sandbox pods running in the k3s cluster cannot resolve host.docker.internal
by default, preventing them from reaching services on the Docker host.

Detect the host gateway IP (default route) in the cluster entrypoint,
thread it through the Helm chart to the gateway server, and inject
hostAliases entries (host.docker.internal, host.openshell.internal)
into every sandbox pod spec. The injection is conditional -- when the
IP is empty (non-Docker deployments), no hostAliases are added.

---------

Co-authored-by: Piotr Mlocek <pmlocek@nvidia.com>
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