Skip to content

Commit ad72b19

Browse files
committed
fix(helm): set control plane resource budgets
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent b099584 commit ad72b19

8 files changed

Lines changed: 152 additions & 30 deletions

File tree

‎deploy/helm/openshell/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ for peer identity policies, multi-node registrations, and authorization.
713713
| 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. |
714714
| 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. |
715715
| replicaCount | int | `1` | Number of OpenShell gateway replicas. Values greater than 1 require server.externalDbSecret because the default SQLite backend is per pod. |
716-
| resources | object | `{}` | Gateway pod resource requests and limits. |
716+
| 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. |
717717
| sandbox.image.digest | string | `""` | Sandbox image digest. When set, this takes precedence over tag. |
718718
| sandbox.image.pullPolicy | string | `nil` | Sandbox image pull policy. Leave unset to use the Kubernetes image default. |
719719
| sandbox.image.repository | string | `"nvcr.io/nvidia/base/ubuntu"` | Default standalone sandbox image repository. |
@@ -842,7 +842,7 @@ for peer identity policies, multi-node registrations, and authorization.
842842
| 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. |
843843
| 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. |
844844
| 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. |
845-
| 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. |
845+
| 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. |
846846
| supervisor.sandboxRuntime.boundaryPort | int | `5500` | Workload boundary TLS listener port. |
847847
| tolerations | list | `[]` | Tolerations for the gateway pod. |
848848
| topologySpreadConstraints | list | `[]` | Topology spread constraints for the gateway pod, used to spread replicas across zones or nodes. Empty = omit the field. |

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ tests:
244244
workload.kind: deployment
245245
server.externalDbSecret: my-pg-secret
246246
autoscaling.enabled: true
247+
resources: null
247248
asserts:
248249
- failedTemplate:
249250
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"
@@ -255,6 +256,7 @@ tests:
255256
set:
256257
autoscaling.targetMemoryUtilizationPercentage: 70
257258
resources.requests.memory: null
259+
resources.limits.memory: null
258260
asserts:
259261
- failedTemplate:
260262
errorPattern: "autoscaling.targetMemoryUtilizationPercentage requires a positive resources.requests.memory"
@@ -294,18 +296,16 @@ tests:
294296
- failedTemplate:
295297
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"
296298

297-
# The chart renders a null request, which Kubernetes stores as zero instead
298-
# of copying the limit.
299-
- it: fails when the CPU request is null even with a CPU limit
300-
template: templates/statefulset.yaml
299+
- it: accepts a CPU limit when null removes the default CPU request
300+
template: templates/hpa.yaml
301301
values:
302302
- ../ci/values-autoscaling.yaml
303303
set:
304304
resources.requests.cpu: null
305305
resources.limits.cpu: "1"
306306
asserts:
307-
- failedTemplate:
308-
errorPattern: "autoscaling.targetCPUUtilizationPercentage requires a positive resources.requests.cpu"
307+
- isKind:
308+
of: HorizontalPodAutoscaler
309309

310310
- it: fails when the CPU request is zero in exponent form
311311
template: templates/statefulset.yaml
@@ -335,6 +335,7 @@ tests:
335335
server.externalDbSecret: my-pg-secret
336336
autoscaling.enabled: true
337337
autoscaling.targetMemoryUtilizationPercentage: 70
338+
resources.requests: null
338339
resources.limits.cpu: "1"
339340
resources.limits.memory: 1Gi
340341
asserts:
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
suite: control plane resource budgets
5+
templates:
6+
- templates/gateway-config.yaml
7+
- templates/statefulset.yaml
8+
- templates/deployment.yaml
9+
- templates/supervisor.yaml
10+
11+
tests:
12+
- it: budgets the default gateway StatefulSet
13+
template: templates/statefulset.yaml
14+
asserts:
15+
- equal:
16+
path: spec.template.spec.containers[0].resources
17+
value: &gatewayBudget
18+
requests:
19+
cpu: 500m
20+
memory: 512Mi
21+
limits:
22+
cpu: "2"
23+
memory: 2Gi
24+
25+
- it: budgets the gateway Deployment
26+
template: templates/deployment.yaml
27+
set:
28+
workload.kind: deployment
29+
server.externalDbSecret: openshell-db
30+
asserts:
31+
- equal:
32+
path: spec.template.spec.containers[0].resources
33+
value: *gatewayBudget
34+
35+
- it: preserves gateway overrides and explicit limit removal
36+
template: templates/statefulset.yaml
37+
set:
38+
resources.requests.cpu: 750m
39+
resources.requests.memory: 1Gi
40+
resources.limits: null
41+
asserts:
42+
- equal:
43+
path: spec.template.spec.containers[0].resources.requests
44+
value:
45+
cpu: 750m
46+
memory: 1Gi
47+
- notExists:
48+
path: spec.template.spec.containers[0].resources.limits
49+
50+
- it: allows removing the gateway budget
51+
template: templates/statefulset.yaml
52+
set:
53+
resources: null
54+
asserts:
55+
- equal:
56+
path: spec.template.spec.containers[0].resources
57+
value: null
58+
59+
- it: leaves the scale profile gateway ceiling to the operator
60+
template: templates/deployment.yaml
61+
values:
62+
- ../values-scale-10k.yaml
63+
set:
64+
server.externalDbSecret: openshell-db
65+
asserts:
66+
- notExists:
67+
path: spec.template.spec.containers[0].resources.limits
68+
69+
- it: allows removing the shared supervisor budget
70+
template: templates/supervisor.yaml
71+
set:
72+
gatewayConfig:
73+
openshell.drivers.kubernetes:
74+
supervisor_topology: gateway
75+
supervisor.resources: null
76+
asserts:
77+
- notExists:
78+
path: spec.template.spec.containers[0].resources

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,15 @@ tests:
377377
path: spec.replicas
378378
value: 1
379379
documentIndex: 0
380-
- notExists:
380+
- equal:
381381
path: spec.template.spec.containers[0].resources
382+
value:
383+
requests:
384+
cpu: 250m
385+
memory: 768Mi
386+
limits:
387+
cpu: "1"
388+
memory: 1.5Gi
382389
documentIndex: 0
383390
- contains:
384391
path: spec.template.spec.containers[0].env

‎deploy/helm/openshell/values-scale-10k.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ replicaCount: 2
1818
workload:
1919
kind: deployment
2020

21+
# Supply measured gateway requests and limits for the intended workload.
22+
# Do not inherit the initial-deployment ceiling at this sandbox count.
23+
resources:
24+
limits: null
25+
2126
gatewayConfig:
2227
openshell.drivers.kubernetes:
2328
supervisor_topology: gateway

‎deploy/helm/openshell/values.yaml‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,17 @@ supervisor:
9595
# maxMembersPerGateway times maxInstancesPerMember sandboxes, never more
9696
# than 131072.
9797
maxMembersPerGateway: 32
98-
# -- Resources of each shared supervisor container, unset by default.
99-
# Memory grows with the sandboxes a supervisor runs; for the default of 128
100-
# sandboxes, request 250m CPU and 768Mi memory with a 1.5Gi memory limit.
101-
# Refer to Size Sandbox Capacity in the High Availability guide.
102-
resources: {}
103-
# requests:
104-
# cpu: 250m
105-
# memory: 768Mi
106-
# limits:
107-
# memory: 1.5Gi
98+
# -- Resources of each shared supervisor container, initially sized for
99+
# 128 sandboxes. Increase these with pool.maxInstancesPerMember and allow
100+
# for failover. Refer to Size Sandbox Capacity in the High Availability guide.
101+
# Set resources to null to omit the budget, or limits to null to omit limits.
102+
resources:
103+
requests:
104+
cpu: 250m
105+
memory: 768Mi
106+
limits:
107+
cpu: "1"
108+
memory: 1.5Gi
108109
autoscaling:
109110
# -- Enable memory-based autoscaling of the shared supervisor Deployment.
110111
# Requires supervisor_topology = "gateway" and the Kubernetes resource
@@ -412,8 +413,17 @@ probes:
412413
# -- Readiness probe failure threshold before the pod is marked not ready.
413414
failureThreshold: 3
414415

415-
# -- Gateway pod resource requests and limits.
416-
resources: {}
416+
# -- Gateway container resource requests and limits for an initial deployment.
417+
# Size for the number of sandboxes, retained logs, traffic, and failover; the
418+
# pool's logical capacity does not determine a safe resource budget.
419+
# Set resources to null to omit the budget, or limits to null to omit limits.
420+
resources:
421+
requests:
422+
cpu: 500m
423+
memory: 512Mi
424+
limits:
425+
cpu: "2"
426+
memory: 2Gi
417427

418428
# -- Node selector for the gateway pod.
419429
nodeSelector: {}

‎docs/kubernetes/high-availability.mdx‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,19 @@ lock held longer than 10 seconds.
303303

304304
## Scale the Gateway
305305

306+
The chart initially requests `500m` CPU and `512Mi` memory per gateway, with
307+
limits of `2` CPUs and `2Gi` memory. These are starting budgets, not resources
308+
for the pool's maximum sandbox count. Size `resources` for your traffic,
309+
sandbox count, and the sessions a surviving replica takes over during failover.
310+
Gateway memory also grows as per-sandbox log tails fill; a full tail can retain
311+
about `4Mi` of heap per sandbox in addition to connections and runtime overhead.
312+
Monitor container memory and CPU throttling when increasing load.
313+
314+
Override individual requests or limits in your values file. Helm merges maps,
315+
so `resources: {}` retains these defaults. Use `resources.limits: null` to
316+
remove the limits, or `resources: null` to remove the whole budget. Removing
317+
requests also requires disabling any HPA utilization targets that depend on them.
318+
306319
Scale the gateway by changing a fixed replica count or by letting a
307320
HorizontalPodAutoscaler choose one. In both cases, keep at least two ready
308321
replicas when availability must survive one gateway pod failure, and size
@@ -703,16 +716,19 @@ helm install openshell <chart> -n openshell \
703716
--set server.externalDbSecret=<secret> --set supervisor.replicas=80
704717
```
705718

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

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

717733
```shell
718734
helm pull oci://quay.io/ai-openshell/charts/openshell --version <version> --untar

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,9 +1409,14 @@ member at its cap, or the pool at gateway replicas × members × instances
14091409
reached"; the gateway log warns "every supervisor is at its sandbox limit" or
14101410
"supervisor pool is at its sandbox limit" to say which. Raise the cap or add
14111411
members. Supervisor container
1412-
resources come from `supervisor.resources` (unset by default; the chart
1413-
recommends requests 250m and 768Mi with a 1.5Gi memory limit for 128
1414-
sandboxes per supervisor). The chart rolls one member
1412+
resources come from `supervisor.resources` (requests 250m and 768Mi, limits
1413+
1 CPU and 1.5Gi by default for 128 sandboxes per supervisor). The gateway
1414+
defaults to requests 500m and 512Mi, limits 2 CPUs and 2Gi. Check for
1415+
`OOMKilled`, CPU throttling, or unschedulable requests; increase budgets for
1416+
sandbox count, full gateway log tails, and failover. Empty maps retain chart
1417+
defaults; set the corresponding `resources` or `resources.limits` to null to
1418+
remove them. The 10,000-sandbox profile leaves gateway limits to the operator.
1419+
The chart rolls one member
14151420
at a time, sets no affinity by default (set `supervisor.affinity` to control
14161421
supervisor scheduling; top-level `affinity` applies only to the gateway), gives
14171422
each member a 60-second grace period to leave,

0 commit comments

Comments
 (0)