Skip to content

Commit 7c8e018

Browse files
authored
feat(helm)!: require opt-in for gateway service routing (#5672)
* feat(helm)!: require opt-in for gateway service routing BREAKING CHANGE: Helm installations relying on gateway service URLs must explicitly set gatewayConfig."openshell.gateway".service_routing_enabled to true before upgrading. Core and non-Kubernetes defaults remain unchanged. Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): explain app listener ingress prerequisites Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): use derived app listener base URL Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * style(e2e): format Helm routing opt-in configuration Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): move SPIFFE guidance into gateway section Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): note routing defaults must stay synchronized Signed-off-by: Taylor Mutch <taylormutch@gmail.com> --------- Signed-off-by: Taylor Mutch <taylormutch@gmail.com>
1 parent b2ab87a commit 7c8e018

9 files changed

Lines changed: 173 additions & 15 deletions

File tree

‎deploy/helm/openshell/README.md‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,55 @@ See [`values.yaml`](values.yaml) for source defaults. Selected overlays:
211211
- [`ci/values-spire.yaml`](ci/values-spire.yaml) - SPIFFE/SPIRE provider token grants
212212
- [`ci/values-spire-stack.yaml`](ci/values-spire-stack.yaml) - SPIRE hardened chart values for local development
213213

214+
### Sandbox service routing
215+
216+
Gateway-mediated sandbox service routing is disabled by default in this Kubernetes
217+
chart to avoid an unintended alternate application access path. Control-plane API
218+
access is unchanged.
219+
220+
For service ingress directly through supervisors, enable
221+
`[openshell.supervisor.app_listener].enabled` and pair it with an ingress solution
222+
that routes requests to the app listener on the supervisor owning each sandbox:
223+
224+
```yaml
225+
gatewayConfig:
226+
openshell.gateway:
227+
enable_gateway_service_routing: false
228+
openshell.supervisor.app_listener:
229+
enabled: true
230+
port: 9443
231+
base_url: https://services.example.com
232+
openshell.drivers.kubernetes.sandbox_runtime.app_listener:
233+
tls_secret_name: openshell-app-tls
234+
```
235+
236+
Provision `openshell-app-tls` with a certificate for `*.services.example.com`.
237+
Pair the listener with a TLS-passthrough proxy or a compatible Kubernetes
238+
ingress/Gateway API integration. The integration consumes service discovery to
239+
map each advertised hostname to the current owning supervisor's IP and configured
240+
app-listener port, preserving the application hostname as Host and TLS SNI.
241+
Configure DNS and NetworkPolicy for that path. Enabling the listener alone does
242+
not provision DNS or external ingress routes, and the chart does not enable it
243+
automatically.
244+
245+
To use gateway-mediated service routing instead, explicitly enable forwarding;
246+
that path does not require the app listener:
247+
248+
```yaml
249+
gatewayConfig:
250+
openshell.gateway:
251+
enable_gateway_service_routing: true
252+
```
253+
254+
Existing Helm installations that rely on gateway service URLs must set this
255+
explicitly before upgrading. Missing saved values receive the disabled chart
256+
default; explicit choices are preserved. If neither routing mode is enabled,
257+
startup logs warn that sandbox service routing is disabled.
258+
259+
The core runtime continues to default gateway routing to enabled, preserving
260+
Docker, Podman, and VM deployments outside this chart. Gateway service
261+
authentication remains independently opt-in.
262+
214263
### Additional destination CAs
215264

216265
Create an operator-owned ConfigMap with a `ca.crt` key when sandboxes must reach
@@ -589,7 +638,8 @@ for peer identity policies, multi-node registrations, and authorization.
589638
| gateway.image.repository | string | `"openshell/gateway"` | Gateway image repository. |
590639
| gateway.image.tag | string | `""` | Gateway image tag. Defaults to the chart appVersion when empty. |
591640
| gateway.listenAddress | string | `"0.0.0.0"` | Gateway listener IP. Use `::` for IPv6. |
592-
| gatewayConfig | object | `{"openshell":{"version":2}}` | Non-secret gateway application configuration. Top-level keys name TOML tables and are rendered into the mounted gateway.toml file. Kubernetes resource inputs remain outside this map; template expressions derive the corresponding runtime values from their resource owner. |
641+
| gatewayConfig | object | `{"openshell":{"version":2},"openshell.gateway":{"enable_gateway_service_routing":false}}` | Non-secret gateway application configuration. Top-level keys name TOML tables and are rendered into the mounted gateway.toml file. Kubernetes resource inputs remain outside this map; template expressions derive the corresponding runtime values from their resource owner. |
642+
| gatewayConfig."openshell.gateway".enable_gateway_service_routing | bool | `false` | Opt in to gateway-mediated sandbox service URLs and forwarding. Disabled for Kubernetes; configure application-listener ingress or explicitly enable this path. |
593643
| global.image.pullPolicy | string | `"IfNotPresent"` | Shared OpenShell image pull policy. Individual image pull policies take precedence. |
594644
| global.image.registry | string | `"ghcr.io/nvidia"` | Shared OpenShell image registry. Individual image registries take precedence. |
595645
| global.image.tag | string | `""` | Shared OpenShell image tag. Defaults to the chart appVersion when empty. |

‎deploy/helm/openshell/README.md.gotmpl‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,55 @@ See [`values.yaml`](values.yaml) for source defaults. Selected overlays:
212212
- [`ci/values-spire.yaml`](ci/values-spire.yaml) - SPIFFE/SPIRE provider token grants
213213
- [`ci/values-spire-stack.yaml`](ci/values-spire-stack.yaml) - SPIRE hardened chart values for local development
214214

215+
### Sandbox service routing
216+
217+
Gateway-mediated sandbox service routing is disabled by default in this Kubernetes
218+
chart to avoid an unintended alternate application access path. Control-plane API
219+
access is unchanged.
220+
221+
For service ingress directly through supervisors, enable
222+
`[openshell.supervisor.app_listener].enabled` and pair it with an ingress solution
223+
that routes requests to the app listener on the supervisor owning each sandbox:
224+
225+
```yaml
226+
gatewayConfig:
227+
openshell.gateway:
228+
enable_gateway_service_routing: false
229+
openshell.supervisor.app_listener:
230+
enabled: true
231+
port: 9443
232+
base_url: https://services.example.com
233+
openshell.drivers.kubernetes.sandbox_runtime.app_listener:
234+
tls_secret_name: openshell-app-tls
235+
```
236+
237+
Provision `openshell-app-tls` with a certificate for `*.services.example.com`.
238+
Pair the listener with a TLS-passthrough proxy or a compatible Kubernetes
239+
ingress/Gateway API integration. The integration consumes service discovery to
240+
map each advertised hostname to the current owning supervisor's IP and configured
241+
app-listener port, preserving the application hostname as Host and TLS SNI.
242+
Configure DNS and NetworkPolicy for that path. Enabling the listener alone does
243+
not provision DNS or external ingress routes, and the chart does not enable it
244+
automatically.
245+
246+
To use gateway-mediated service routing instead, explicitly enable forwarding;
247+
that path does not require the app listener:
248+
249+
```yaml
250+
gatewayConfig:
251+
openshell.gateway:
252+
enable_gateway_service_routing: true
253+
```
254+
255+
Existing Helm installations that rely on gateway service URLs must set this
256+
explicitly before upgrading. Missing saved values receive the disabled chart
257+
default; explicit choices are preserved. If neither routing mode is enabled,
258+
startup logs warn that sandbox service routing is disabled.
259+
260+
The core runtime continues to default gateway routing to enabled, preserving
261+
Docker, Podman, and VM deployments outside this chart. Gateway service
262+
authentication remains independently opt-in.
263+
215264
### Additional destination CAs
216265

217266
Create an operator-owned ConfigMap with a `ca.crt` key when sandboxes must reach

‎deploy/helm/openshell/templates/_toml.tpl‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ Top-level lists represent TOML arrays of tables and preserve their YAML order. *
102102
{{- $config := deepCopy (.Values.gatewayConfig | default dict) -}}
103103
{{- $legacyServer := .Values.server | default dict -}}
104104
{{- $gateway := get $config "openshell.gateway" | default dict -}}
105+
{{/* Keep the Kubernetes routing default when saved values omit it or use null.
106+
Keep this default in sync with gatewayConfig."openshell.gateway".enable_gateway_service_routing in values.yaml. */}}
107+
{{- if or (not (hasKey $gateway "enable_gateway_service_routing")) (eq (get $gateway "enable_gateway_service_routing") nil) -}}
108+
{{- $_ := set $gateway "enable_gateway_service_routing" false -}}
109+
{{- end -}}
105110
{{- if not (hasKey $gateway "name") -}}{{- $_ := set $gateway "name" (get $legacyServer "name" | default (include "openshell.fullname" .)) -}}{{- end -}}
106111
{{/* The Service and probes own listener ports, so keep runtime listeners aligned. */}}
107112
{{- $listenHost := include "openshell.listenHost" .Values.gateway.listenAddress -}}

‎deploy/helm/openshell/tests/gateway_config_test.yaml‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,40 @@ release:
1313
namespace: my-namespace
1414

1515
tests:
16-
- it: leaves gateway service routing enabled by the runtime default when omitted
16+
- it: disables gateway service routing by default on Kubernetes
1717
template: templates/gateway-config.yaml
1818
asserts:
19-
- notMatchRegex:
19+
- matchRegex:
2020
path: data["gateway.toml"]
21-
pattern: 'enable_gateway_service_routing\s*='
21+
pattern: '(?m)^enable_gateway_service_routing\s*=\s*false$'
22+
23+
- it: allows explicitly enabling gateway service routing
24+
template: templates/gateway-config.yaml
25+
set:
26+
gatewayConfig:
27+
openshell.gateway:
28+
enable_gateway_service_routing: true
29+
asserts:
30+
- matchRegex:
31+
path: data["gateway.toml"]
32+
pattern: '(?m)^enable_gateway_service_routing\s*=\s*true$'
33+
34+
- it: defaults gateway routing off when saved configuration omits the gateway table
35+
template: templates/gateway-config.yaml
36+
set:
37+
gatewayConfig:
38+
openshell.gateway: null
39+
asserts:
40+
- matchRegex:
41+
path: data["gateway.toml"]
42+
pattern: '(?m)^enable_gateway_service_routing\s*=\s*false$'
2243

23-
- it: disables gateway service routing through canonical configuration
44+
- it: defaults gateway routing off when saved configuration omits the flag
2445
template: templates/gateway-config.yaml
2546
set:
2647
gatewayConfig:
2748
openshell.gateway:
28-
enable_gateway_service_routing: false
49+
enable_gateway_service_routing: null
2950
asserts:
3051
- matchRegex:
3152
path: data["gateway.toml"]

‎deploy/helm/openshell/values.yaml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,13 @@ topologySpreadConstraints: []
411411
gatewayConfig:
412412
openshell:
413413
version: 2
414-
# openshell.gateway.spiffe_broker enables gateway-owned sandbox JWT-SVID
415-
# acquisition over mTLS. Configure node_local_port or endpoint, an exact or
416-
# cluster-scoped peer identity, the Workload API socket, and the stable sandbox
417-
# SPIFFE ID prefix. SPIRE must authorize the gateway and attest its Sandbox references.
414+
openshell.gateway:
415+
# openshell.gateway.spiffe_broker enables gateway-owned sandbox JWT-SVID
416+
# acquisition over mTLS. Configure node_local_port or endpoint, an exact or
417+
# cluster-scoped peer identity, the Workload API socket, and the stable sandbox
418+
# SPIFFE ID prefix. SPIRE must authorize the gateway and attest its Sandbox references.
419+
# -- Opt in to gateway-mediated sandbox service URLs and forwarding. Disabled for Kubernetes; configure application-listener ingress or explicitly enable this path.
420+
enable_gateway_service_routing: false
418421

419422
# Server configuration
420423
server:

‎docs/how-it-works/gateways/configuration.mdx‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,9 @@ and `https://<workspace>--<sandbox>.<base-domain>/` for the unnamed endpoint.
616616
The base domain is the first wildcard DNS SAN in `server_sans`; gateways
617617
without SANs use the built-in `openshell.localhost`.
618618

619-
`enable_gateway_service_routing` defaults to `true`. Set it to `false` to stop publishing
619+
The core runtime defaults `enable_gateway_service_routing` to `true`; Docker, Podman,
620+
and VM gateway behavior is unchanged. The Kubernetes Helm chart defaults it to
621+
`false`. Set it to `false` to stop publishing
620622
gateway service URLs and reject gateway-mediated application HTTP requests and
621623
WebSocket upgrades with `404`. Control-plane APIs, service declarations, direct
622624
supervisor listeners, and discovery remain available. The setting also accepts
@@ -630,6 +632,26 @@ gatewayConfig:
630632
enable_gateway_service_routing: false
631633
```
632634
635+
For Kubernetes service ingress directly through supervisors, set
636+
`[openshell.supervisor.app_listener].enabled = true` and configure the
637+
[supervisor application listener](#supervisor-application-listener). Pair it with
638+
an ingress solution, such as a TLS-passthrough proxy or a compatible Kubernetes
639+
ingress/Gateway API integration, that consumes discovery and routes each
640+
advertised hostname to the current owning supervisor's app-listener IP and port.
641+
Preserve the application hostname as Host and TLS SNI. Enabling the listener
642+
alone does not provision DNS or external ingress routes; the chart does not
643+
enable either the listener or the ingress integration automatically.
644+
645+
If both routing modes are disabled, startup logs warn that sandbox service
646+
routing is disabled. Gateway-mediated forwarding does not require the app
647+
listener.
648+
649+
When upgrading a Helm installation that uses gateway service URLs, explicitly
650+
set `enable_gateway_service_routing: true` in the canonical table above before the
651+
upgrade. Missing saved values receive the chart's `false` default; explicit
652+
`true` values remain enabled. This changes application forwarding only, not
653+
control-plane API access or the service-authentication default.
654+
633655
With gateway routing disabled, `gateway_url` is empty and `gateway_service_urls`
634656
is empty. A configured application origin supplies the preferred URL; without
635657
one, preferred URLs are empty. Idempotent retries preserve all recorded URL fields together. Use service

‎e2e/kubernetes/app-listener/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ differs from the repository's mise environment.
3131
`OPENSHELL_E2E_APP_DELIVERY` accepts `push` (default) or `poll`;
3232
`OPENSHELL_E2E_APP_TAKEOVER` accepts `graceful` (default) or `abrupt` for shared
3333
supervisors. Dedicated runs include gateway-outage expiry. Every run also
34-
disables the listener and verifies absent app sockets/TLS mounts/Services and
35-
continued gateway application ingress. Logs, events, and resource summaries
34+
disables the listener, explicitly enables gateway routing for the fallback
35+
check, and verifies absent app sockets/TLS mounts/Services and continued gateway
36+
application ingress. Logs, events, and resource summaries
3637
are written under `results/app-listener/`, without TLS private keys or Secrets.
3738

3839
GitHub Actions runs four matrix cases under the existing `test:e2e` label:

‎e2e/kubernetes/app-listener/run.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,10 @@ def wait_for_shared_hosts():
279279
json.dumps(
280280
{
281281
"gatewayConfig": {
282-
"openshell.supervisor.app_listener": {"enabled": False}
282+
"openshell.supervisor.app_listener": {"enabled": False},
283+
"openshell.gateway": {
284+
"enable_gateway_service_routing": True
285+
},
283286
}
284287
}
285288
)

‎skills/debug-openshell-cluster/SKILL.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,11 @@ Watches recheck bearer credentials and membership every second. Allow one refres
18241824
interval for withdrawals; route lease expiry remains independently enforced.
18251825

18261826
For incorrect public service URLs, inspect
1827-
`[openshell.gateway].enable_gateway_service_routing` first. When false, gateway URL fields
1827+
`[openshell.gateway].enable_gateway_service_routing` first. The Helm chart defaults it
1828+
to false; the core runtime and non-Kubernetes deployments retain true. To retain
1829+
gateway forwarding in a Helm deployment or upgrade, set
1830+
`gatewayConfig."openshell.gateway".enable_gateway_service_routing: true` explicitly.
1831+
When false, gateway URL fields
18281832
are empty and gateway application requests return `404`; direct listener and
18291833
discovery behavior is independent. Then inspect
18301834
`[openshell.supervisor.app_listener].base_url`. It is the external HTTPS base origin

0 commit comments

Comments
 (0)