Files

91 lines
2.8 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: sgl-router
namespace: sgl-router-test
spec:
replicas: 1
selector:
matchLabels:
app: sgl-router
template:
metadata:
labels:
app: sgl-router
spec:
serviceAccountName: sgl-router
# Must exceed --shutdown-drain-secs plus the time in-flight requests
# need after the pause, or the pod is SIGKILLed mid-drain and the drain
# has bought nothing.
terminationGracePeriodSeconds: 40
containers:
- name: router
image: sgl-router:e2e
imagePullPolicy: Never
# Configured entirely via CLI flags. K8s EndpointSlice discovery
# watches `app=sglang` pods in this namespace. The aggressive
# circuit breaker (threshold 1, 5s cool-down) lets a terminating
# pod's connection-refused immediately drop it from the candidate
# set — the reconciliation tests scale workers rapidly and depend
# on fast eviction to absorb the churn.
args:
- "--host"
- "0.0.0.0"
- "--port"
- "8090"
- "--model-id"
- "tiny"
- "--tokenizer-path"
- "/etc/tokenizer/tiny.json"
- "--policy"
- "round_robin"
- "--cb-threshold"
- "1"
- "--cb-cool-down-secs"
- "5"
- "--service-discovery"
- "--service-discovery-namespace"
- "sgl-router-test"
- "--selector"
- "app=sglang"
# On SIGTERM, keep serving with /readyz at 503 so the endpoint
# removal reaches kube-proxy before the listener closes. Sized for
# the deletionTimestamp path, which does not wait on a probe.
# Probe-driven deregistration would instead need this above the
# readinessProbe's failureThreshold * periodSeconds below.
# test_shutdown_drain.py reads this value; do not restate it there.
- "--shutdown-drain-secs"
- "8"
# Declared so the startup advisory compares the drain against this
# pod's real grace period instead of assuming the k8s default.
- "--termination-grace-secs"
- "40"
ports:
- containerPort: 8090
name: http
readinessProbe:
httpGet:
path: /readyz
port: 8090
initialDelaySeconds: 3
periodSeconds: 3
livenessProbe:
httpGet:
path: /healthz
port: 8090
initialDelaySeconds: 5
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: sgl-router
namespace: sgl-router-test
spec:
selector:
app: sgl-router
ports:
- name: http
port: 8090
targetPort: 8090