Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/helm/openshell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ for peer identity policies, multi-node registrations, and authorization.
| rbac.clusterScoped.create | bool | `true` | Create the cluster-scoped ClusterRole and ClusterRoleBinding. Disable for a namespace-admin install where a cluster-admin applies them separately; the gateway ServiceAccount name and namespace are unchanged, so a pre-created ClusterRoleBinding still matches. |
| rbac.create | bool | `true` | Create the RBAC objects that grant the gateway ServiceAccount access. Disable to supply the namespaced sandbox and peer Role/RoleBinding and the cluster-scoped ClusterRole/ClusterRoleBinding out of band. The certgen hook and credential driver RBAC keep their own flags. |
| replicaCount | int | `1` | Number of OpenShell gateway replicas. Values greater than 1 require server.externalDbSecret because the default SQLite backend is per pod. |
| resources | object | `{}` | Gateway pod resource requests and limits. |
| resources | object | `{"limits":{"cpu":"2","memory":"2Gi"},"requests":{"cpu":"500m","memory":"512Mi"}}` | Gateway container resource requests and limits for an initial deployment. Size for the number of sandboxes, retained logs, traffic, and failover; the pool's logical capacity does not determine a safe resource budget. Set resources to null to omit the budget, or limits to null to omit limits. |
| sandbox.image.digest | string | `""` | Sandbox image digest. When set, this takes precedence over tag. |
| sandbox.image.pullPolicy | string | `nil` | Sandbox image pull policy. Leave unset to use the Kubernetes image default. |
| sandbox.image.repository | string | `"nvcr.io/nvidia/base/ubuntu"` | Default standalone sandbox image repository. |
Expand Down Expand Up @@ -843,7 +843,7 @@ for peer identity policies, multi-node registrations, and authorization.
| supervisor.pool.maxMembersPerGateway | int | `32` | Most supervisors one gateway replica serves, rendered as [openshell.gateway.supervisor_pool] max_members_per_gateway. Must be a positive integer. The pool runs at most gateway replicas times maxMembersPerGateway times maxInstancesPerMember sandboxes, never more than 131072. |
| supervisor.recoveryTimeoutSeconds | int | `60` | Seconds a sandbox workload stays frozen after losing its pool member's supervision before the sandbox runtime terminates it, rendered as [openshell.gateway.supervisor_pool] recovery_timeout_secs. Must be an integer from 30 to 300. Null leaves the gateway's pool default of 60 seconds. |
| supervisor.replicas | int | `1` | Shared supervisor pool members, used only when gatewayConfig selects supervisor_topology = "gateway". The gateway always coordinates the shared supervisor as a high-availability pool: when a member fails or leaves, another member takes over its sandboxes without restarting their workloads. 1 has no failover; use 2 or more to survive losing a member. Only the supervisor Deployment's replica count depends on this value, so changing it neither restarts the gateway nor replaces running members. Ignored when supervisor.autoscaling.enabled is true. Must not exceed replicaCount * supervisor.pool.maxMembersPerGateway. |
| supervisor.resources | object | `{}` | Resources of each shared supervisor container, unset by default. Memory grows with the sandboxes a supervisor runs; for the default of 128 sandboxes, request 250m CPU and 768Mi memory with a 1.5Gi memory limit. Refer to Size Sandbox Capacity in the High Availability guide. |
| supervisor.resources | object | `{"limits":{"cpu":"1","memory":"1.5Gi"},"requests":{"cpu":"250m","memory":"768Mi"}}` | Resources of each shared supervisor container, initially sized for 128 sandboxes. Increase these with pool.maxInstancesPerMember and allow for failover. Refer to Size Sandbox Capacity in the High Availability guide. Set resources to null to omit the budget, or limits to null to omit limits. |
| supervisor.sandboxRuntime.boundaryPort | int | `5500` | Workload boundary TLS listener port. |
| tolerations | list | `[]` | Tolerations for the gateway pod. |
| topologySpreadConstraints | list | `[]` | Topology spread constraints for the gateway pod, used to spread replicas across zones or nodes. Empty = omit the field. |
Expand Down
13 changes: 7 additions & 6 deletions deploy/helm/openshell/tests/autoscaling_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ tests:
workload.kind: deployment
server.externalDbSecret: my-pg-secret
autoscaling.enabled: true
resources: null
asserts:
- failedTemplate:
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"
Expand All @@ -255,6 +256,7 @@ tests:
set:
autoscaling.targetMemoryUtilizationPercentage: 70
resources.requests.memory: null
resources.limits.memory: null
asserts:
- failedTemplate:
errorPattern: "autoscaling.targetMemoryUtilizationPercentage requires a positive resources.requests.memory"
Expand Down Expand Up @@ -294,18 +296,16 @@ tests:
- failedTemplate:
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"

# The chart renders a null request, which Kubernetes stores as zero instead
# of copying the limit.
- it: fails when the CPU request is null even with a CPU limit
template: templates/statefulset.yaml
- it: accepts a CPU limit when null removes the default CPU request
template: templates/hpa.yaml
values:
- ../ci/values-autoscaling.yaml
set:
resources.requests.cpu: null
resources.limits.cpu: "1"
asserts:
- failedTemplate:
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"
- isKind:
of: HorizontalPodAutoscaler

- it: fails when the CPU request is zero in exponent form
template: templates/statefulset.yaml
Expand Down Expand Up @@ -335,6 +335,7 @@ tests:
server.externalDbSecret: my-pg-secret
autoscaling.enabled: true
autoscaling.targetMemoryUtilizationPercentage: 70
resources.requests: null
resources.limits.cpu: "1"
resources.limits.memory: 1Gi
asserts:
Expand Down
78 changes: 78 additions & 0 deletions deploy/helm/openshell/tests/resources_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

suite: control plane resource budgets
templates:
- templates/gateway-config.yaml
- templates/statefulset.yaml
- templates/deployment.yaml
- templates/supervisor.yaml

tests:
- it: budgets the default gateway StatefulSet
template: templates/statefulset.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value: &gatewayBudget
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: "2"
memory: 2Gi

- it: budgets the gateway Deployment
template: templates/deployment.yaml
set:
workload.kind: deployment
server.externalDbSecret: openshell-db
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value: *gatewayBudget

- it: preserves gateway overrides and explicit limit removal
template: templates/statefulset.yaml
set:
resources.requests.cpu: 750m
resources.requests.memory: 1Gi
resources.limits: null
asserts:
- equal:
path: spec.template.spec.containers[0].resources.requests
value:
cpu: 750m
memory: 1Gi
- notExists:
path: spec.template.spec.containers[0].resources.limits

- it: allows removing the gateway budget
template: templates/statefulset.yaml
set:
resources: null
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value: null

- it: leaves the scale profile gateway ceiling to the operator
template: templates/deployment.yaml
values:
- ../values-scale-10k.yaml
set:
server.externalDbSecret: openshell-db
asserts:
- notExists:
path: spec.template.spec.containers[0].resources.limits

- it: allows removing the shared supervisor budget
template: templates/supervisor.yaml
set:
gatewayConfig:
openshell.drivers.kubernetes:
supervisor_topology: gateway
supervisor.resources: null
asserts:
- notExists:
path: spec.template.spec.containers[0].resources
9 changes: 8 additions & 1 deletion deploy/helm/openshell/tests/supervisor_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,15 @@ tests:
path: spec.replicas
value: 1
documentIndex: 0
- notExists:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
cpu: 250m
memory: 768Mi
limits:
cpu: "1"
memory: 1.5Gi
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].env
Expand Down
5 changes: 5 additions & 0 deletions deploy/helm/openshell/values-scale-10k.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ replicaCount: 2
workload:
kind: deployment

# Supply measured gateway requests and limits for the intended workload.
# Do not inherit the initial-deployment ceiling at this sandbox count.
resources:
limits: null

gatewayConfig:
openshell.drivers.kubernetes:
supervisor_topology: gateway
Expand Down
34 changes: 22 additions & 12 deletions deploy/helm/openshell/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,17 @@ supervisor:
# maxMembersPerGateway times maxInstancesPerMember sandboxes, never more
# than 131072.
maxMembersPerGateway: 32
# -- Resources of each shared supervisor container, unset by default.
# Memory grows with the sandboxes a supervisor runs; for the default of 128
# sandboxes, request 250m CPU and 768Mi memory with a 1.5Gi memory limit.
# Refer to Size Sandbox Capacity in the High Availability guide.
resources: {}
# requests:
# cpu: 250m
# memory: 768Mi
# limits:
# memory: 1.5Gi
# -- Resources of each shared supervisor container, initially sized for
# 128 sandboxes. Increase these with pool.maxInstancesPerMember and allow
# for failover. Refer to Size Sandbox Capacity in the High Availability guide.
# Set resources to null to omit the budget, or limits to null to omit limits.
resources:
requests:
cpu: 250m
memory: 768Mi
limits:
cpu: "1"
memory: 1.5Gi
autoscaling:
# -- Enable memory-based autoscaling of the shared supervisor Deployment.
# Requires supervisor_topology = "gateway" and the Kubernetes resource
Expand Down Expand Up @@ -415,8 +416,17 @@ probes:
# -- Readiness probe failure threshold before the pod is marked not ready.
failureThreshold: 3

# -- Gateway pod resource requests and limits.
resources: {}
# -- Gateway container resource requests and limits for an initial deployment.
# Size for the number of sandboxes, retained logs, traffic, and failover; the
# pool's logical capacity does not determine a safe resource budget.
# Set resources to null to omit the budget, or limits to null to omit limits.
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: "2"
memory: 2Gi

# -- Node selector for the gateway pod.
nodeSelector: {}
Expand Down
7 changes: 6 additions & 1 deletion deploy/helm/test-supervisor-pool-scaling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,14 @@ render defaults
[[ "$(supervisor_replicas defaults)" == "1" ]] || fail "the default pool renders $(supervisor_replicas defaults) replicas"
yq ea -e 'select(.kind == "HorizontalPodAutoscaler") | .metadata.name' "${work_dir}/defaults.yaml" >/dev/null 2>&1 \
&& fail "the default pool renders an HPA"
yq ea -e 'select(.kind == "Deployment" and .metadata.name == "scaling-openshell-supervisor")
| .spec.template.spec.containers[0] | has("resources")' \
"${work_dir}/defaults.yaml" >/dev/null || fail "the supervisor renders no resource budget by default"

render no-budget --set supervisor.resources=null
yq ea -e 'select(.kind == "Deployment" and .metadata.name == "scaling-openshell-supervisor")
| .spec.template.spec.containers[0] | has("resources") | not' \
"${work_dir}/defaults.yaml" >/dev/null || fail "the supervisor renders resources by default"
"${work_dir}/no-budget.yaml" >/dev/null || fail "the supervisor renders resources after explicit removal"

# The pool limits reach the gateway table and every supervisor alike.
render limits --set supervisor.pool.maxInstancesPerMember=16 --set supervisor.pool.maxMembersPerGateway=4
Expand Down
35 changes: 29 additions & 6 deletions docs/kubernetes/high-availability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,26 @@ lock held longer than 10 seconds.

## Scale the Gateway

The chart initially requests `500m` CPU and `512Mi` memory per gateway, with
limits of `2` CPUs and `2Gi` memory. These are starting budgets, not resources
for the pool's maximum sandbox count. Size `resources` for your traffic,
sandbox count, and the sessions a surviving replica takes over during failover.
Gateway memory also grows as per-sandbox log tails fill; a full tail can retain
about `4Mi` of heap per sandbox in addition to connections and runtime overhead.
Monitor container memory and CPU throttling when increasing load.

Override individual requests or limits in your values file. Helm merges maps,
so `resources: {}` retains these defaults. Use `resources.limits: null` to
remove the limits, or `resources: null` to remove the whole budget. Removing
requests also requires disabling any HPA utilization targets that depend on them.

Before upgrading an existing release, check its gateway memory usage. Installs
that never set `resources` gain the `2Gi` memory limit when adopting these
defaults and can be OOM-killed if their usage exceeds it. Requests-only
overrides also retain default limits: `resources.requests.memory: 4Gi` with
the default `2Gi` limit produces an invalid Pod. Set matching limits for your
workload or remove them explicitly before upgrading.

Scale the gateway by changing a fixed replica count or by letting a
HorizontalPodAutoscaler choose one. In both cases, keep at least two ready
replicas when availability must survive one gateway pod failure, and size
Expand Down Expand Up @@ -703,16 +723,19 @@ helm install openshell <chart> -n openshell \
--set server.externalDbSecret=<secret> --set supervisor.replicas=80
```

Supervisor memory grows with the sandboxes it runs. The chart sets no
`supervisor.resources` by default. For 128 sandboxes per supervisor, request
`250m` CPU and `768Mi` memory, with a `1.5Gi` memory limit, and scale memory
with `maxInstancesPerMember`.
Supervisor memory grows with the sandboxes it runs. For the default of 128
sandboxes per supervisor, `supervisor.resources` requests `250m` CPU and
`768Mi` memory, with limits of `1` CPU and `1.5Gi` memory. Increase the budget
with `maxInstancesPerMember`, and leave capacity for a member failure. Use
`supervisor.resources.limits: null` to remove limits or
`supervisor.resources: null` to omit the budget.

The chart ships `values-scale-10k.yaml` as a starting point for about 10,000
sandboxes: 2 gateway replicas with up to 40 supervisors each, and a supervisor
HPA from 10 to 80 replicas at 128 sandboxes each. It needs an external
database. Pull the chart to get the file, then install from the extracted
copy:
database. The profile removes the initial gateway limits; set measured gateway
requests and limits for your workload before production use. Pull the chart
to get the file, then install from the extracted copy:

```shell
helm pull oci://quay.io/ai-openshell/charts/openshell --version <version> --untar
Expand Down
11 changes: 8 additions & 3 deletions skills/debug-openshell-cluster/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,14 @@ member at its cap, or the pool at gateway replicas × members × instances
reached"; the gateway log warns "every supervisor is at its sandbox limit" or
"supervisor pool is at its sandbox limit" to say which. Raise the cap or add
members. Supervisor container
resources come from `supervisor.resources` (unset by default; the chart
recommends requests 250m and 768Mi with a 1.5Gi memory limit for 128
sandboxes per supervisor). The chart rolls one member
resources come from `supervisor.resources` (requests 250m and 768Mi, limits
1 CPU and 1.5Gi by default for 128 sandboxes per supervisor). The gateway
defaults to requests 500m and 512Mi, limits 2 CPUs and 2Gi. Check for
`OOMKilled`, CPU throttling, or unschedulable requests; increase budgets for
sandbox count, full gateway log tails, and failover. Empty maps retain chart
defaults; set the corresponding `resources` or `resources.limits` to null to
remove them. The 10,000-sandbox profile leaves gateway limits to the operator.
The chart rolls one member
at a time, sets no affinity by default (set `supervisor.affinity` to control
supervisor scheduling; top-level `affinity` applies only to the gateway), gives
each member a 60-second grace period to leave,
Expand Down
Loading