Files
responses-shim/deploy/responses-shim-b300-cw.yaml
T

75 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# responses-shim — DeepSeek Responses API (/v1/responses) → chat completions 协议转换
# 架构: 客户端 → new-api(:31000, /v1/responses 原路径透传) → 本服务(渠道上游) → ds41-3p1d:50002
# 部署: wsl kmctl create cw ds41-resp-shim -f /mnt/d/B300/build-kmctl/responses-shim-cw.yaml --node-group B300
# 镜像: ymkymx/responses-shim:v0.1.0(scratch+静态 Go 二进制,5.6MB,
# 已 docker save | ctr -n k8s.io images import 侧载到 b300-01;Kyverno 对未映射镜像保持原名)
# 网络: 普通 Pod 网络 + ClusterIP Service(同 jaeger 之外的常规姿势);new-api 渠道 base URL 填
# http://ds41-resp-shim:8080 (同 namespace 短名可达,与 ds41-3p1d 同理)
# 透传: /v1/chat/completions 字节级透传(渠道测试/健康检查/误路由的 chat 请求都正常)
# 源码: D:\B300\responses-shim\main.go(另存 b300 /data/ymk/build/responses-shim/)
apiVersion: apps/v1
kind: Deployment
metadata:
name: responses-shim
labels:
app: responses-shim
spec:
replicas: 1
strategy:
type: Recreate # 无状态但无需滚动,重建越快越好
selector:
matchLabels:
app: responses-shim
template:
metadata:
labels:
app: responses-shim
spec:
nodeSelector:
kubernetes.io/hostname: b300-01
containers:
- name: shim
image: ymkymx/responses-shim:v0.2.5
imagePullPolicy: IfNotPresent
env:
- name: UPSTREAM_BASE
value: "http://ds41-3p1d:50002"
- name: LISTEN
value: ":8080"
- name: STOP_SCOPE
value: "content" # stop 只在 content 上截断,思维链不被误杀(Claude stop_sequences 语义)
ports:
- {containerPort: 8080}
resources:
# 2026-10-09 用户指令:推荐 4c/16Gi 防崩——shim 会缓冲完整上游响应体
# (非流式聚合 + STOP_SCOPE=content 的跨 chunk 匹配),内存随
# 并发数 × 单响应大小增长,1c/512Mi 在大并发长输出下有 OOM 风险
requests:
cpu: "1"
memory: 4Gi
limits:
cpu: "4"
memory: 16Gi
readinessProbe:
httpGet: {path: /healthz, port: 8080}
initialDelaySeconds: 2
periodSeconds: 10
livenessProbe:
httpGet: {path: /healthz, port: 8080}
initialDelaySeconds: 5
periodSeconds: 20
---
apiVersion: v1
kind: Service
metadata:
name: ds41-resp-shim
labels:
app: responses-shim
spec:
selector:
app: responses-shim
ports:
- name: http
port: 8080
targetPort: 8080