Files
ljwx-stock/k8s/configmap.yaml
T
brunoandClaude e135a6396f feat: 实现完整的 CICD 流程
- 添加 Gitea Actions 工作流 (.gitea/workflows/)
  - cicd.yml: 完整 CICD 流程(构建、测试、推送、部署)
  - test.yml: 快速测试工作流

- 配置 Kubernetes 部署清单 (k8s/)
  - namespace.yaml: 创建 claude-stock namespace
  - configmap.yaml: 应用配置和 Ollama 连接配置
  - deployment.yaml: 后端和前端部署(支持 Node IP 连接 Ollama)
  - service.yaml: 服务定义、RBAC 和网络策略
  - ollama-bridge.yaml: 四种 K8s 与宿主 Ollama 通信方案
  - secrets.sh: 自动创建 K8s Secrets

- 部署脚本和工具
  - deploy-to-k8s.sh: 一键 K8s 部署脚本
  - verify-cicd.sh: CICD 环境验证脚本

- 文档
  - CICD_DEPLOYMENT_GUIDE.md: 完整部署指南(中文)
  - QUICK_START.md: 5 分钟快速启动指南(中文)

关键功能:
✅ Gitea Runners(Docker + K8s)
✅ Harbor 镜像仓库集成
✅ 自动化测试和安全扫描
✅ K8s 滚动更新和健康检查
✅ Ollama 集成(使用 Node IP 解决通信问题)
✅ 完整的部署后验证

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 11:56:09 +08:00

57 lines
1.5 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.
apiVersion: v1
kind: ConfigMap
metadata:
name: claude-stock-config
namespace: claude-stock
data:
# OpenRouter API 配置
OPENROUTER_BASE_URL: "https://openrouter.ai/api/v1"
# Ollama 本地部署配置 - 关键!
# 使用 host.docker.internal 等价物:在 K8s 中使用 Node IP
OLLAMA_BASE_URL: "http://host.docker.internal:11434"
DEEPSEEK_MODEL: "qwen3-coder:30b-a3b-q8_0"
# TuShare API
TUSHARE_BASE_URL: "https://tushare.pro"
# 数据库配置
DATABASE_URL: "postgresql://stockai:stockai2025@postgres:5432/stock_ai"
REDIS_URL: "redis://:redis2025@redis:6379/0"
# 应用配置
ENVIRONMENT: "production"
LOG_LEVEL: "info"
TZ: "Asia/Shanghai"
# 前端配置
VITE_API_URL: "http://claude-stock-backend:8000"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ollama-client-config
namespace: claude-stock
data:
# 用于连接到宿主 Ollama 的配置脚本
init-ollama-host.sh: |
#!/bin/bash
set -e
# 获取宿主 IP(在 K8s 中通常是 Node IP)
# 方法1: 使用 DNS 解析 kubernetes.default
HOST_IP=$(nslookup kubernetes.default | grep "^Address:" | head -n1 | awk '{print $2}')
# 方法2: 如果 DNS 不可用,使用 route 命令
if [ -z "$HOST_IP" ]; then
HOST_IP=$(route -n | grep '^0.0.0.0' | awk '{print $3}')
fi
echo "Detected Host IP: $HOST_IP"
# 更新环境变量
export OLLAMA_BASE_URL="http://$HOST_IP:11434"
echo "Ollama endpoint set to: $OLLAMA_BASE_URL"