Hub relays pi's own --mode json session protocol (session/agent_start/ turn_start/message_*/turn_end/agent_end -- the same event shape Claude Code sessions use) to agent-console over WebSocket, so concurrent pi runs inside the pod are observable as real transcripts instead of log tails. agent-run.js wraps `pi -p --mode json` and relays its stdout lines to the hub; each invocation gets its own session id, so N concurrent agents show up as N sessions. Source mounted via ConfigMap and run with `go run .` (no registry yet, same as the pi container).
89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: agent-pod
|
|
namespace: agent-pod
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: agent-pod
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: agent-pod
|
|
spec:
|
|
# api.riotpiao.com has no in-cluster DNS record (only resolves from the
|
|
# home network's own resolver) -- pin it to ingress-nginx-controller's
|
|
# ClusterIP so pi's models.json baseUrl works unchanged. TLS still
|
|
# terminates correctly since SNI/Host still say api.riotpiao.com.
|
|
hostAliases:
|
|
- ip: "10.101.128.185"
|
|
hostnames:
|
|
- "api.riotpiao.com"
|
|
containers:
|
|
- name: pi
|
|
image: node:22-slim
|
|
command:
|
|
- sh
|
|
- -c
|
|
- "npm install -g @earendil-works/[email protected] && sleep infinity"
|
|
resources:
|
|
requests:
|
|
cpu: "2"
|
|
memory: 4Gi
|
|
limits:
|
|
cpu: "4"
|
|
memory: 8Gi
|
|
volumeMounts:
|
|
- name: pi-config
|
|
mountPath: /root/.pi/config.json
|
|
subPath: config.json
|
|
- name: pi-config
|
|
mountPath: /root/.pi/agent/settings.json
|
|
subPath: settings.json
|
|
- name: pi-models
|
|
mountPath: /root/.pi/agent/models.json
|
|
subPath: models.json
|
|
- name: agent-run-script
|
|
mountPath: /root/agent-run.js
|
|
subPath: agent-run.js
|
|
# Sidecar: relays pi's --mode json session events to agent-console.
|
|
# Runs via `go run` on mounted source rather than a prebuilt image --
|
|
# same "no registry yet" tradeoff as the pi container's npm install.
|
|
- name: hub
|
|
image: golang:1.25-alpine
|
|
workingDir: /hub
|
|
command:
|
|
- sh
|
|
- -c
|
|
- "go run ."
|
|
env:
|
|
- name: HUB_ADDR
|
|
value: ":9090"
|
|
ports:
|
|
- containerPort: 9090
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 256Mi
|
|
volumeMounts:
|
|
- name: hub-src
|
|
mountPath: /hub
|
|
volumes:
|
|
- name: pi-config
|
|
configMap:
|
|
name: pi-config
|
|
- name: pi-models
|
|
secret:
|
|
secretName: pi-models
|
|
- name: agent-run-script
|
|
configMap:
|
|
name: agent-run-script
|
|
- name: hub-src
|
|
configMap:
|
|
name: hub-src
|