Skip to content

Commit a138874

Browse files
authored
feat(helm): preflight gateway storage on install (#5774)
* feat(helm): preflight gateway storage on install Signed-off-by: Shiju <shiju@nvidia.com> * docs(helm): clarify storage preflight recovery Signed-off-by: Shiju <shiju@nvidia.com> --------- Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 03908a0 commit a138874

6 files changed

Lines changed: 123 additions & 0 deletions

File tree

‎deploy/helm/openshell/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ supported Sandbox API (`agents.x-k8s.io/v1beta1` or
163163
`agentSandbox.preflight.enabled=false` for offline `helm template` rendering,
164164
where Helm cannot discover cluster APIs.
165165

166+
Run `kubectl get storageclass` before installing. For dynamic provisioning
167+
without a default, set `server.dataStorageClass` (gateway StatefulSet) and
168+
`server.workspaceStorageClass` (sandbox workspaces).
169+
170+
`storageClass.preflight.enabled=true` checks gateway storage on fresh StatefulSet
171+
installs with no gateway class set. The Helm identity needs cluster-scoped
172+
`list storageclasses` permission. A denied lookup stops Helm rendering. If
173+
that permission is unavailable, set `server.dataStorageClass` explicitly or
174+
disable the preflight. If a reinstall reuses retained gateway PVCs, set
175+
`storageClass.preflight.enabled=false`. Preview with `helm template --dry-run=server`.
176+
166177
## Install on Kubernetes
167178

168179
```shell
@@ -807,6 +818,7 @@ for peer identity policies, multi-node registrations, and authorization.
807818
| serviceAccount.annotations | object | `{}` | Annotations to add to the generated service account. |
808819
| serviceAccount.create | bool | `true` | Create a service account for the gateway. |
809820
| serviceAccount.name | string | `""` | Existing service account name to use when serviceAccount.create is false. |
821+
| storageClass.preflight.enabled | bool | `false` | On a fresh StatefulSet install with no server.dataStorageClass, check for a default StorageClass. The Helm identity must be allowed to list StorageClasses. |
810822
| supervisor.affinity | object | `{}` | Affinity rules for the shared supervisor pod, rendered only when gatewayConfig selects supervisor_topology = "gateway". Top-level affinity applies only to the gateway pod. |
811823
| supervisor.autoscaling.behavior | object | `{"scaleDown":{"policies":[{"periodSeconds":120,"type":"Pods","value":1}],"stabilizationWindowSeconds":300}}` | HPA scaling behavior. Remove at most one member every two minutes, after a five-minute stabilization window, to allow ownership handoff. |
812824
| supervisor.autoscaling.enabled | bool | `false` | Enable memory-based autoscaling of the shared supervisor Deployment. Requires supervisor_topology = "gateway" and the Kubernetes resource metrics API (usually Metrics Server). When enabled, the HPA owns the replica count and supervisor.replicas is ignored. |

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ supported Sandbox API (`agents.x-k8s.io/v1beta1` or
164164
`agentSandbox.preflight.enabled=false` for offline `helm template` rendering,
165165
where Helm cannot discover cluster APIs.
166166

167+
Run `kubectl get storageclass` before installing. For dynamic provisioning
168+
without a default, set `server.dataStorageClass` (gateway StatefulSet) and
169+
`server.workspaceStorageClass` (sandbox workspaces).
170+
171+
`storageClass.preflight.enabled=true` checks gateway storage on fresh StatefulSet
172+
installs with no gateway class set. The Helm identity needs cluster-scoped
173+
`list storageclasses` permission. A denied lookup stops Helm rendering. If
174+
that permission is unavailable, set `server.dataStorageClass` explicitly or
175+
disable the preflight. If a reinstall reuses retained gateway PVCs, set
176+
`storageClass.preflight.enabled=false`. Preview with `helm template --dry-run=server`.
177+
167178
## Install on Kubernetes
168179

169180
```shell
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{/*
2+
SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
*/}}
5+
{{- if and .Release.IsInstall .Values.storageClass.preflight.enabled
6+
(eq (include "openshell.workloadKind" .) "statefulset")
7+
(not .Values.server.dataStorageClass) }}
8+
{{- $classes := lookup "storage.k8s.io/v1" "StorageClass" "" "" }}
9+
{{/* Offline Helm renders return an empty map. A live list has an items field. */}}
10+
{{- if hasKey $classes "items" }}
11+
{{- $hasDefault := false }}
12+
{{- range $classes.items }}
13+
{{- $annotations := .metadata.annotations | default dict }}
14+
{{- if or (eq (get $annotations "storageclass.kubernetes.io/is-default-class") "true") (eq (get $annotations "storageclass.beta.kubernetes.io/is-default-class") "true") }}
15+
{{- $hasDefault = true }}
16+
{{- end }}
17+
{{- end }}
18+
{{- if not $hasDefault }}
19+
{{- fail "The cluster has no default StorageClass. Set server.dataStorageClass for the gateway openshell-data PVC. If you are reusing retained gateway PVCs or managing the backing storage yourself, set storageClass.preflight.enabled=false." }}
20+
{{- end }}
21+
{{- end }}
22+
{{- end }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
suite: StorageClass preflight
5+
templates:
6+
- templates/storage-class-preflight.yaml
7+
set:
8+
agentSandbox.preflight.enabled: false
9+
storageClass.preflight.enabled: true
10+
kubernetesProvider:
11+
scheme:
12+
storage.k8s.io/v1/StorageClass:
13+
gvr:
14+
group: storage.k8s.io
15+
version: v1
16+
resource: storageclasses
17+
namespaced: false
18+
objects:
19+
- apiVersion: storage.k8s.io/v1
20+
kind: StorageClass
21+
metadata:
22+
name: fast-ssd
23+
24+
tests:
25+
- it: explains the gateway class setting and retained PVC opt-out when no default exists
26+
asserts:
27+
- failedTemplate:
28+
errorPattern: 'The cluster has no default StorageClass\. Set server\.dataStorageClass.*reusing retained gateway PVCs.*storageClass\.preflight\.enabled=false'
29+
30+
- it: skips the check for a gateway Deployment
31+
set:
32+
workload.kind: deployment
33+
server.externalDbSecret: postgres
34+
asserts:
35+
- hasDocuments:
36+
count: 0
37+
38+
- it: accepts an explicit gateway class
39+
set:
40+
server.dataStorageClass: fast-ssd
41+
asserts:
42+
- hasDocuments:
43+
count: 0
44+
45+
- it: skips the check on an upgrade without a default class
46+
release:
47+
install: false
48+
upgrade: true
49+
asserts:
50+
- hasDocuments:
51+
count: 0
52+
53+
- it: accepts a default class
54+
kubernetesProvider:
55+
objects:
56+
- apiVersion: storage.k8s.io/v1
57+
kind: StorageClass
58+
metadata:
59+
name: default-ssd
60+
annotations:
61+
storageclass.kubernetes.io/is-default-class: "true"
62+
asserts:
63+
- hasDocuments:
64+
count: 0

‎deploy/helm/openshell/values.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ agentSandbox:
326326
# -- Check the live cluster for a supported Agent Sandbox API before rendering gateway resources. Disable only for offline rendering and linting.
327327
enabled: true
328328

329+
storageClass:
330+
preflight:
331+
# -- On a fresh StatefulSet install with no server.dataStorageClass, check for a default StorageClass. The Helm identity must be allowed to list StorageClasses.
332+
enabled: false
333+
329334
# Pod restart behavior and health probe tuning.
330335
podLifecycle:
331336
# -- Maximum time, in seconds, Kubernetes waits for the gateway to exit before

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,15 @@ the release. Look for failed installs, unexpected values, missing namespace, wro
534534
image tag, TLS settings that do not match the registered endpoint, and
535535
scheduling failures.
536536

537+
If the opt-in storage preflight stops a fresh StatefulSet install, run
538+
`kubectl get storageclass` and set `server.dataStorageClass` to an existing
539+
class for dynamic provisioning. The Helm identity needs cluster-scoped
540+
`list storageclasses` permission for the check. If the API denies the lookup,
541+
set an explicit gateway class or disable the check. Set
542+
`storageClass.preflight.enabled=false` when reinstalling with retained gateway
543+
PVCs. Check `server.workspaceStorageClass` separately when the cluster has no
544+
default class.
545+
537546
If Kubernetes rejects `app.kubernetes.io/version` on a resource or certgen hook,
538547
inspect the rendered label and chart app version. Charts normalize SemVer build
539548
metadata for labels (`0.1.9+build.1` becomes `0.1.9_build.1`) without changing

0 commit comments

Comments
 (0)