feat(redis): 支持 TLS + 密码 + REDIS_URL(接托管 Redis,如 heicode-rd)

orchestrator/redis_client.py 之前只支持裸 redis.Redis(host,port,db)
明文连接,无法连 Azure Redis Enterprise(强制 TLS + access key)。

改动:
- 新增 REDIS_URL(优先),rediss:// 自动启用 TLS,凭据写在 URL;
  否则用离散 REDIS_HOST/PORT/DB + 可选 REDIS_PASSWORD / REDIS_SSL。
- 完全向后兼容:都不设时维持现有明文 redis-service:6379 行为。
- 凭据只读 env(经 Secret/secret_ref 注入),日志只打脱敏目标,
  绝不输出 URL / 密码。
- 新增 scripts/test-redis-connection-config.py(无需真实 redis)。
- k8s manifest 补 Secret 引用示例;DELIVERY.md 补环境变量表。

验证:新单测 3 项 + REDIS_FAKE 回退 + test-runtime-contract /
test-contract-freeze / test-merge-smoke 全 PASS。

影响范围:仅 agent_swarm(orchestrator 连接层)。
不改 Manager↔Swarm 契约 / 计费 / 审计字段 / 发布链路。
涉及密钥:仅新增「从环境读取」路径,无任何密钥写入代码或日志。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fasthei
2026-06-12 16:50:27 +08:00
co-authored by Claude Opus 4.8
parent b83638a475
commit aa498fc318
4 changed files with 167 additions and 12 deletions
+13
View File
@@ -40,12 +40,25 @@ spec:
- containerPort: 8000
name: http
env:
# Default: in-cluster plaintext Redis (StatefulSet redis-service).
- name: REDIS_HOST
value: "redis-service"
- name: REDIS_PORT
value: "6379"
- name: REDIS_DB
value: "0"
# To use a managed TLS Redis (e.g. Azure Cache / Redis Enterprise)
# instead of the in-cluster StatefulSet, drop the REDIS_HOST/PORT above
# and inject a credentialed URL from a Secret (never inline a password):
# - name: REDIS_URL
# valueFrom:
# secretKeyRef:
# name: swarm-integration # rediss://:<password>@<host>:10000/0
# key: redis_url
# Or use discrete vars: REDIS_HOST/REDIS_PORT + REDIS_SSL=1 and
# - name: REDIS_PASSWORD
# valueFrom:
# secretKeyRef: { name: swarm-integration, key: redis_password }
- name: LOG_LEVEL
value: "INFO"
resources: