mirror of
https://github.com/sredevopsorg/deepseek-kubernetes-sandbox.git
synced 2026-11-03 01:13:24 +00:00
* Rewrite DSH gateway for browser sessions, HTTP and WebSocket - Replace the Flask proxy with a Starlette ASGI app (uvicorn factory), keeping the control plane (claims, wake/suspend, idle sweeper). - Add HttpOnly gateway sessions and a server-side DSH launch-token handshake: read the token from pod logs, exchange it for a dsh-auth cookie, cache per (user, pod UID, Host), refresh once on 401. - Proxy HTTP/SSE and WebSocket (/api/remote.mux) under /u/<user>/, with header stripping/injection, Location rewriting and wake-on-connect. - Add a landing/signup/login page, health endpoint, pinned dependencies, a read-only-rootfs gateway image, 87 cluster-free tests and docs. * Fix DSH probe crash-loop and harden gateway manifests - Probe /favicon.svg instead of /: DSH gates / behind its launch-token cookie and returns 401, which made warm-pool pods crash-loop. - Pass DSH_TRUSTED_HOSTS through the entrypoint as --trusted-host args for public/ingress hosts; keep localhost trusted. - Deploy the published :gateway image, add pods/pods-log RBAC, /healthz probes, read-only rootfs with a /tmp emptyDir and non-root security. - Add optional Traefik Ingress and document the prerequisites. * Update CI, smoke tests, build tooling and docs - Run gateway pytest/ruff and build/smoke-test the image in CI. - Parameterize the DSH build version and pnpm version inputs. - Exercise cookie signup, HTML proxy, WebSocket auth, suspend/wake and delete in run-test-kind.sh. - Add Makefile/build.sh targets and document the architecture, handshake, probes, trusted hosts, troubleshooting and limitations. --------- Co-authored-by: SREDevOpsAgents <agents@sredevops.org>
80 lines
2.8 KiB
YAML
80 lines
2.8 KiB
YAML
# Minimal single-tenant SandboxTemplate for DeepSeek Harness Web.
|
|
#
|
|
# This is the "just one DSH Web" quick-start template. For the full
|
|
# multi-tenant platform (warm pool, per-user claims, gateway, idle-suspend),
|
|
# see examples/dsh-agents-as-a-service/.
|
|
#
|
|
# Prerequisites (create these first, or apply 00-prereqs.yaml from the
|
|
# examples directory):
|
|
# - Namespace dsh-demo.
|
|
# - Secret dsh-provider-keys in dsh-demo with key DEEPSEEK_API_KEY
|
|
# (injected via envFrom; the pod starts without it, only model calls fail).
|
|
# The agent-sandbox controller (v1.0.7, API v1beta1) must be installed.
|
|
apiVersion: extensions.agents.x-k8s.io/v1beta1
|
|
kind: SandboxTemplate
|
|
metadata:
|
|
name: dsh-web-template
|
|
namespace: dsh-demo
|
|
spec:
|
|
service: true # headless Service per Sandbox -> stable DNS (status.serviceFQDN)
|
|
podTemplate:
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000 # Matches the UID of the 'node' user
|
|
runAsGroup: 1000
|
|
fsGroup: 1000
|
|
containers:
|
|
- name: dsh-web
|
|
image: ghcr.io/sredevopsorg/deepseek-kubernetes-sandbox:dsh-v0.2.1-rc.2
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: web
|
|
containerPort: 3080
|
|
envFrom:
|
|
- secretRef:
|
|
name: dsh-provider-keys # Secret with key DEEPSEEK_API_KEY
|
|
env:
|
|
# Empty => DSH derives links from the request Host. Keep it empty
|
|
# when fronting the sandbox with a proxy/gateway.
|
|
- name: DSH_PUBLIC_URL
|
|
value: ""
|
|
# DSH Host/Origin-fences /api. Empty trusts only localhost, which
|
|
# is right for `kubectl port-forward`. Set this to the public host
|
|
# (e.g. dsh.example.com) if you expose DSH behind an Ingress, so
|
|
# requests forwarded with the browser's Host are accepted.
|
|
- name: DSH_TRUSTED_HOSTS
|
|
value: ""
|
|
volumeMounts:
|
|
- name: dsh-home
|
|
mountPath: /home/node/.dsh # DSH_HOME
|
|
# / is behind DSH's launch-token cookie (401 without it); use an
|
|
# unauthenticated path for probes.
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /favicon.svg
|
|
port: 3080
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /favicon.svg
|
|
port: 3080
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 15
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: dsh-home
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
# storageClassName omitted => cluster default
|