Files
OpenShell/deploy/helm/openshell/tests/replica_routing_test.yaml
Divesh 834b79a8c2 feat(server): place supervisor sessions by consistent hash (#3661)
* feat(server): place supervisor sessions by consistent hash and hand them off on shutdown

Signed-off-by: divesh <dgude@nvidia.com>

* feat: route long-lived sandbox connections to the owning gateway replica

Signed-off-by: divesh <dgude@nvidia.com>

* feat(helm): add opt-in per-replica GRPCRoute routing

Signed-off-by: divesh <dgude@nvidia.com>

---------

Signed-off-by: divesh <dgude@nvidia.com>
2026-10-07 05:01:32 +00:00

112 lines
3.2 KiB
YAML

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
suite: GRPCRoute replica routing
templates:
- templates/grpcroute.yaml
- templates/replica-services.yaml
- templates/gateway-config.yaml
- templates/statefulset.yaml
release:
name: openshell
namespace: my-namespace
set:
grpcRoute.enabled: true
replicaCount: 2
workload.allowMultiReplicaStatefulSet: true
server.externalDbSecret: db
tests:
- it: routes every request to the shared Service by default
template: templates/grpcroute.yaml
asserts:
- lengthEqual:
path: spec.rules
count: 1
- equal:
path: spec.rules[0].backendRefs[0].name
value: openshell
- it: renders no per-replica Services by default
template: templates/replica-services.yaml
asserts:
- hasDocuments:
count: 0
- it: renders when values from an older release have no replicaRouting key
template: templates/grpcroute.yaml
set:
grpcRoute.replicaRouting: null
asserts:
- lengthEqual:
path: spec.rules
count: 1
- it: routes a named replica to its own Service ahead of the shared rule
template: templates/grpcroute.yaml
set:
grpcRoute.replicaRouting.enabled: true
asserts:
- lengthEqual:
path: spec.rules
count: 3
- equal:
path: spec.rules[1].matches[0].headers[0]
value:
type: Exact
name: x-openshell-replica
value: openshell-1
- equal:
path: spec.rules[1].backendRefs[0].name
value: openshell-replica-1
- equal:
path: spec.rules[2].backendRefs[0].name
value: openshell
- it: selects exactly one pod per replica Service
template: templates/replica-services.yaml
set:
grpcRoute.replicaRouting.enabled: true
asserts:
- hasDocuments:
count: 2
- equal:
path: metadata.name
value: openshell-replica-1
documentIndex: 1
- equal:
path: spec.selector["statefulset.kubernetes.io/pod-name"]
value: openshell-1
documentIndex: 1
- it: routes every replica the autoscaler can create
template: templates/grpcroute.yaml
set:
grpcRoute.replicaRouting.enabled: true
autoscaling.enabled: true
resources.requests.cpu: 100m
asserts:
- lengthEqual:
path: spec.rules
count: 5
- it: caps autoscaled replica routing at 15 replicas
template: templates/statefulset.yaml
set:
grpcRoute.replicaRouting.enabled: true
autoscaling.enabled: true
autoscaling.maxReplicas: 16
resources.requests.cpu: 100m
asserts:
- failedTemplate:
errorMessage: "grpcRoute.replicaRouting.enabled supports autoscaling.maxReplicas of at most 15; a GRPCRoute holds at most 16 rules."
- it: requires a StatefulSet for stable replica names
template: templates/statefulset.yaml
set:
grpcRoute.replicaRouting.enabled: true
workload.kind: deployment
asserts:
- failedTemplate:
errorMessage: "grpcRoute.replicaRouting.enabled requires workload.kind=statefulset so each replica has a stable name."