Skip to content

Commit fe3942f

Browse files
gmenherTaylorMutch
andauthored
feat(helm): migrate gateway configuration to gatewayConfig (#3384)
* feat(helm): add generic gateway TOML serializer Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * docs(architecture): define Helm gateway configuration boundary Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * feat(helm): define default gateway configuration map Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): render gateway config from values map Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * test(helm): cover generic gateway TOML rendering Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * feat(helm): protect gateway config secret boundary Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * docs(helm): classify legacy gateway configuration values Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): derive dual-use resources from gateway config Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * test(helm): migrate gateway config scenarios Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): derive credential resources from gateway config Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): migrate gateway config overlays Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): remove gateway configuration shadow values Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * refactor(helm): align runtime config with resources Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * docs(helm): add gateway config migration guide Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * test(helm): validate rendered gateway config Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * test(helm): cover config resource coherence Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): make Kubernetes E2E deployable Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(e2e): pass host aliases through gateway config Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * docs(e2e): reference gateway config host alias Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): enforce gateway resource ownership Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * test(e2e): cover chart host gateway input Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): address gateway config review findings Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): repair RFC 0012 migration integration Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(e2e): align Kubernetes parity with RFC 0012 Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): complete gateway config migration Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * chore(helm): add SPDX header to TOML template * fix(helm): preserve legacy gateway configuration aliases Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): complete legacy gateway config compatibility Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * feat(helm): support gateway config arrays of tables * fix(helm): preserve sandbox identity aliases * fix(helm): address gateway config review findings Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> * fix(helm): preserve gateway config migration settings Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * test(helm): validate extension arrays in CI values Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * fix(helm): restore unconditional SPDX headers Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * fix(helm): restore route SPDX header placement Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): simplify configuration and migration examples Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): remove redundant flag explanations Signed-off-by: Taylor Mutch <taylormutch@gmail.com> * docs(helm): move chart configuration guidance to Kubernetes setup Signed-off-by: Taylor Mutch <taylormutch@gmail.com> --------- Signed-off-by: Gaizka Menendez Hernandez <gmenende@redhat.com> Signed-off-by: Taylor Mutch <taylormutch@gmail.com> Co-authored-by: Taylor Mutch <taylormutch@gmail.com>
1 parent aad551d commit fe3942f

54 files changed

Lines changed: 2171 additions & 531 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/openshell-server/src/config_file.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,17 @@ mod tests {
763763
}
764764
}
765765

766+
#[test]
767+
fn gateway_rate_limits_reject_negative_values_during_toml_parsing() {
768+
for field in ["grpc_rate_limit_requests", "grpc_rate_limit_window_seconds"] {
769+
let tmp = write_tmp(&format!("[openshell.gateway]\n{field} = -1\n"));
770+
assert!(
771+
matches!(load(tmp.path()), Err(ConfigFileError::Parse { .. })),
772+
"{field} must reject negative values because gateway rate limits are unsigned"
773+
);
774+
}
775+
}
776+
766777
#[test]
767778
fn canonical_compute_driver_is_singular() {
768779
let file: ConfigFile = toml::from_str(

‎deploy/helm/openshell/README.md‎

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,37 @@ database. The chart creates a retained Kubernetes Secret with the shared
240240
key-encryption key and injects that key into every gateway pod, so the same
241241
default works for single-replica and external database-backed HA deployments.
242242

243-
Use `kubernetes-secrets` or `vault` instead when credentials should live in a
244-
cluster or external secret backend. Enabling one external credential driver
245-
disables the default credential-storage key-encryption key Secret and env injection.
243+
Use `gatewayConfig` to select `kubernetes-secrets` or `vault` when credentials
244+
should live in a cluster or external secret backend. Selecting an external
245+
credential driver disables the default credential-storage key-encryption-key
246+
Secret and environment injection. The map is rendered directly as gateway TOML,
247+
so it uses the gateway's snake_case field names:
248+
249+
```yaml
250+
gatewayConfig:
251+
openshell.gateway:
252+
credential_drivers:
253+
- vault
254+
openshell.credential_drivers.vault:
255+
address: https://vault.vault.svc.cluster.local:8200
256+
mount: secret
257+
kv_version: "2"
258+
auth_method: kubernetes
259+
role: openshell-gateway
260+
```
261+
262+
> `gatewayConfig` must contain only non-secret values. Helm serializes unknown
263+
> fields generically and cannot determine whether an arbitrary string, such as
264+
> `api_token`, is confidential. Do not put passwords, tokens, private keys,
265+
> database URLs, or other secret material in this map. Use Secret-backed
266+
> environment variables, files, volumes, or gateway credential drivers instead.
267+
> The chart rejects known unsafe forms such as `database_url`, inline URL
268+
> credentials, and PEM private keys; it is not a general secret scanner.
269+
270+
For the Kubernetes Secret driver, use
271+
`openshell.credential_drivers.kubernetes-secrets.namespace` in the same map.
272+
The chart derives any required RBAC from the selected driver; use a dedicated
273+
namespace to limit access to OpenShell-managed Secrets.
246274

247275
#### OpenShift
248276

@@ -318,12 +346,16 @@ JWT signing Secret.
318346

319347
## SPIFFE/SPIRE provider token grants
320348

321-
Set `server.providerTokenGrants.spiffe.enabled=true` to let the gateway and
322-
sandbox supervisors use SPIFFE JWT-SVIDs for dynamic provider token grants. The
323-
chart keeps supervisor-to-gateway authentication on gateway-minted sandbox JWTs,
324-
mounts the SPIFFE CSI socket into the gateway pod, exports
325-
`OPENSHELL_GATEWAY_SPIFFE_WORKLOAD_API_SOCKET`, and passes the socket path to
326-
the Kubernetes driver so sandbox pods can mount the same socket.
349+
Set `gatewayConfig.openshell.drivers.kubernetes.provider_spiffe_workload_api_socket_path`
350+
to let sandbox supervisors use SPIFFE JWT-SVIDs for dynamic provider token
351+
grants. The chart keeps supervisor-to-gateway authentication on gateway-minted
352+
sandbox JWTs and passes the configured socket path to the Kubernetes driver.
353+
354+
```yaml
355+
gatewayConfig:
356+
openshell.drivers.kubernetes:
357+
provider_spiffe_workload_api_socket_path: /spiffe-workload-api/spire-agent.sock
358+
```
327359

328360
For local development, uncomment the SPIRE Helm releases in `skaffold.yaml` and
329361
add `ci/values-spire.yaml` to the OpenShell release values files.
@@ -353,12 +385,14 @@ discovery endpoint or its TLS CA.
353385
| certManager.serverDnsNames | list | `["openshell","openshell.openshell.svc","openshell.openshell.svc.cluster.local","localhost","openshell.localhost","*.openshell.localhost","host.docker.internal"]` | DNS SANs on the cert-manager-issued server certificate. |
354386
| certManager.serverIpAddresses | list | `["127.0.0.1"]` | IP SANs on the cert-manager-issued server certificate. |
355387
| certManager.serverIssuerRef | object | `{"group":"","kind":"","name":""}` | Override the issuerRef for the external server Certificate (e.g. a real LetsEncrypt/ACME ClusterIssuer for a publicly-trusted cert on an external hostname). When set, the chart creates a second server certificate from this issuer with only the hostnames in serverDnsNames; the internal server certificate is always signed by the chart's own CA. Leave name empty to use the chart CA for all server certificates (default). Requires certManager.enabled=true. |
388+
| credentialDrivers.vault.caConfigMapName | string | `""` | ConfigMap containing the private Vault/OpenBao CA certificate under the ca.crt key. Helm mounts it only when the Vault driver is selected. |
356389
| fullnameOverride | string | `""` | Override the full generated resource name. |
357390
| gateway.image.digest | string | `""` | Gateway image digest. When set, this takes precedence over tag. |
358391
| gateway.image.pullPolicy | string | `nil` | Gateway image pull policy. Empty uses global.image.pullPolicy. |
359392
| gateway.image.registry | string | `""` | Gateway image registry. Empty uses global.image.registry. |
360393
| gateway.image.repository | string | `"openshell/gateway"` | Gateway image repository. |
361394
| gateway.image.tag | string | `""` | Gateway image tag. Defaults to the chart appVersion when empty. |
395+
| 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. |
362396
| global.image.pullPolicy | string | `"IfNotPresent"` | Shared OpenShell image pull policy. Individual image pull policies take precedence. |
363397
| global.image.registry | string | `"ghcr.io/nvidia"` | Shared OpenShell image registry. Individual image registries take precedence. |
364398
| global.image.tag | string | `""` | Shared OpenShell image tag. Defaults to the chart appVersion when empty. |

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

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,37 @@ database. The chart creates a retained Kubernetes Secret with the shared
241241
key-encryption key and injects that key into every gateway pod, so the same
242242
default works for single-replica and external database-backed HA deployments.
243243

244-
Use `kubernetes-secrets` or `vault` instead when credentials should live in a
245-
cluster or external secret backend. Enabling one external credential driver
246-
disables the default credential-storage key-encryption key Secret and env injection.
244+
Use `gatewayConfig` to select `kubernetes-secrets` or `vault` when credentials
245+
should live in a cluster or external secret backend. Selecting an external
246+
credential driver disables the default credential-storage key-encryption-key
247+
Secret and environment injection. The map is rendered directly as gateway TOML,
248+
so it uses the gateway's snake_case field names:
249+
250+
```yaml
251+
gatewayConfig:
252+
openshell.gateway:
253+
credential_drivers:
254+
- vault
255+
openshell.credential_drivers.vault:
256+
address: https://vault.vault.svc.cluster.local:8200
257+
mount: secret
258+
kv_version: "2"
259+
auth_method: kubernetes
260+
role: openshell-gateway
261+
```
262+
263+
> `gatewayConfig` must contain only non-secret values. Helm serializes unknown
264+
> fields generically and cannot determine whether an arbitrary string, such as
265+
> `api_token`, is confidential. Do not put passwords, tokens, private keys,
266+
> database URLs, or other secret material in this map. Use Secret-backed
267+
> environment variables, files, volumes, or gateway credential drivers instead.
268+
> The chart rejects known unsafe forms such as `database_url`, inline URL
269+
> credentials, and PEM private keys; it is not a general secret scanner.
270+
271+
For the Kubernetes Secret driver, use
272+
`openshell.credential_drivers.kubernetes-secrets.namespace` in the same map.
273+
The chart derives any required RBAC from the selected driver; use a dedicated
274+
namespace to limit access to OpenShell-managed Secrets.
247275

248276
#### OpenShift
249277

@@ -319,12 +347,16 @@ JWT signing Secret.
319347

320348
## SPIFFE/SPIRE provider token grants
321349

322-
Set `server.providerTokenGrants.spiffe.enabled=true` to let the gateway and
323-
sandbox supervisors use SPIFFE JWT-SVIDs for dynamic provider token grants. The
324-
chart keeps supervisor-to-gateway authentication on gateway-minted sandbox JWTs,
325-
mounts the SPIFFE CSI socket into the gateway pod, exports
326-
`OPENSHELL_GATEWAY_SPIFFE_WORKLOAD_API_SOCKET`, and passes the socket path to
327-
the Kubernetes driver so sandbox pods can mount the same socket.
350+
Set `gatewayConfig.openshell.drivers.kubernetes.provider_spiffe_workload_api_socket_path`
351+
to let sandbox supervisors use SPIFFE JWT-SVIDs for dynamic provider token
352+
grants. The chart keeps supervisor-to-gateway authentication on gateway-minted
353+
sandbox JWTs and passes the configured socket path to the Kubernetes driver.
354+
355+
```yaml
356+
gatewayConfig:
357+
openshell.drivers.kubernetes:
358+
provider_spiffe_workload_api_socket_path: /spiffe-workload-api/spire-agent.sock
359+
```
328360

329361
For local development, uncomment the SPIRE Helm releases in `skaffold.yaml` and
330362
add `ci/values-spire.yaml` to the OpenShell release values files.

‎deploy/helm/openshell/ci/values-corporate-proxy-e2e.yaml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
# The Kubernetes corporate-proxy e2e wrapper supplies the generated proxy URL
55
# and creates `openshell-e2e-proxy-auth` before Helm installs the gateway.
6-
upstreamProxy:
7-
authSecret:
8-
name: openshell-e2e-proxy-auth
9-
key: proxy-auth
10-
authAllowInsecure: true
6+
gatewayConfig:
7+
openshell.drivers.kubernetes:
8+
# The e2e wrapper replaces this endpoint with its dynamically allocated
9+
# port. Keep the overlay valid when rendered independently as well.
10+
https_proxy: http://host.openshell.internal:8080
11+
proxy_auth_secret_name: openshell-e2e-proxy-auth
12+
proxy_auth_secret_key: proxy-auth
13+
proxy_auth_allow_insecure: true

‎deploy/helm/openshell/ci/values-credential-driver-kubernetes-secrets.yaml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
# Use with:
77
# skaffold run -p credential-driver-kubernetes-secrets
88
#
9-
server:
10-
credentialDrivers:
11-
kubernetesSecrets:
12-
enabled: true
13-
namespace: openshell
9+
gatewayConfig:
10+
openshell.gateway:
11+
credential_drivers:
12+
- kubernetes-secrets
13+
openshell.credential_drivers.kubernetes-secrets:
14+
namespace: openshell

‎deploy/helm/openshell/ci/values-credential-driver-vault.yaml‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
#
99
# The profile assumes another process has already deployed a Vault-compatible
1010
# backend. Local e2e validation deploys OpenBao in the `openbao` namespace with
11-
# TLS enabled, publishes its private CA in the `openbao-ca` ConfigMap, and
12-
# creates an `openbao-0` DNS alias matching the OpenBao dev certificate. It also
13-
# configures a Kubernetes auth role named `openshell-gateway` bound to the
14-
# OpenShell gateway ServiceAccount in the `openshell` namespace.
11+
# a Kubernetes auth role named `openshell-gateway` bound to the OpenShell
12+
# gateway ServiceAccount in the `openshell` namespace.
1513

16-
server:
17-
credentialDrivers:
18-
vault:
19-
enabled: true
20-
address: https://openbao-0:8200
21-
caConfigMapName: openbao-ca
22-
role: openshell-gateway
14+
gatewayConfig:
15+
openshell.gateway:
16+
credential_drivers:
17+
- vault
18+
openshell.credential_drivers.vault:
19+
# The local E2E fixture exposes this alias in the gateway namespace. It
20+
# also matches the DNS SAN in OpenBao's development TLS certificate.
21+
address: https://openbao-0:8200
22+
role: openshell-gateway
23+
24+
credentialDrivers:
25+
vault:
26+
caConfigMapName: openbao-ca
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Render/preflight example for operator-run extensions. Top-level YAML lists
5+
# emit one TOML [[table]] per entry, preserving the list and explicit order.
6+
# The CI parser check does not connect to these example endpoints. Deploy the
7+
# services separately before using this overlay with a running gateway.
8+
gatewayConfig:
9+
openshell.gateway.interceptors:
10+
- name: governance
11+
grpc_endpoint: http://governance.ns.svc.cluster.local:18081
12+
allow_insecure_transport: true
13+
order: 0
14+
failure_policy: fail_closed
15+
- name: audit
16+
grpc_endpoint: http://audit.ns.svc.cluster.local:18081
17+
allow_insecure_transport: true
18+
order: 1
19+
failure_policy: fail_open
20+
openshell.supervisor.middleware:
21+
- name: content-guard
22+
grpc_endpoint: http://content-guard.ns.svc.cluster.local:18082
23+
allow_insecure_transport: true
24+
max_payload_bytes: 262144
25+
timeout: 500ms
26+
- name: request-audit
27+
grpc_endpoint: http://request-audit.ns.svc.cluster.local:18082
28+
allow_insecure_transport: true
29+
max_payload_bytes: 262144
30+
timeout: 1s

‎deploy/helm/openshell/ci/values-gateway-tls.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ grpcRoute:
2828
server:
2929
# Envoy terminates TLS at the edge; the gateway listens plaintext behind it.
3030
disableTls: true
31-
oidc:
31+
32+
gatewayConfig:
33+
openshell.gateway.oidc:
3234
issuer: "https://keycloak.example.com/realms/openshell"
3335
audience: "openshell-cli"

‎deploy/helm/openshell/ci/values-keycloak.yaml‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,23 @@
2121
# CLI token acquisition: keep a port-forward running while using openshell login:
2222
# kubectl -n keycloak port-forward svc/keycloak 9090:80
2323

24-
server:
25-
oidc:
24+
gatewayConfig:
25+
openshell.gateway.oidc:
2626
# Must match KC_HOSTNAME set by keycloak:k8s:setup (in-cluster service hostname).
2727
issuer: "https://keycloak.keycloak.svc.cluster.local:443/realms/openshell"
28-
caConfigMapName: "openshell-keycloak-ca"
2928
# Must match the client ID in the imported realm (openshell-cli).
3029
audience: "openshell-cli"
3130
# Short TTL for dev so JWKS key rotation is picked up quickly.
3231
# Use 3600 (default) in production.
33-
jwksTtl: 60
32+
jwks_ttl_secs: 60
3433
# Keycloak puts realm roles at realm_access.roles in the JWT.
35-
rolesClaim: "realm_access.roles"
34+
roles_claim: "realm_access.roles"
3635
# Leave both empty for authentication-only mode (any valid token is accepted).
37-
adminRole: "openshell-admin"
38-
userRole: "openshell-user"
36+
admin_role: "openshell-admin"
37+
user_role: "openshell-user"
38+
39+
# This is a Kubernetes ConfigMap mounted by the chart, not a gateway TOML
40+
# field, so it remains a chart-owned resource reference.
41+
server:
42+
oidc:
43+
caConfigMapName: "openshell-keycloak-ca"

‎deploy/helm/openshell/ci/values-openshift-e2e.yaml‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,22 @@
2525
# is true and mTLS is MANDATORY at the TLS handshake — a caller with only the
2626
# Route URL and no client certificate is rejected before any RPC. The passthrough
2727
# Route terminates TLS at the gateway pod, so this holds end-to-end.
28-
# `allowUnauthenticatedUsers` only promotes the already cert-verified caller to a
28+
# `allow_unauthenticated_users` only promotes the already cert-verified caller to a
2929
# dev principal at the app layer (mtls_auth is unsupported with the Kubernetes
3030
# driver). Both are required together; the client certificate is the access gate.
3131
gateway:
3232
image:
3333
pullPolicy: Always
3434

35-
supervisor:
36-
image:
37-
pullPolicy: Always
38-
3935
server:
4036
disableTls: false
41-
auth:
42-
allowUnauthenticatedUsers: true
37+
38+
gatewayConfig:
39+
openshell.gateway.auth:
40+
allow_unauthenticated_users: true
41+
openshell.drivers.kubernetes:
42+
sandbox_runtime_image_pull_policy: always
43+
supervisor_image_pull_policy: always
4344

4445
openshiftRoute:
4546
enabled: true

0 commit comments

Comments
 (0)