108 lines
4.7 KiB
Markdown
108 lines
4.7 KiB
Markdown
# MixingX.Hub.Chart
|
|
|
|
> Legacy note: repository root is the historical all-in-one chart. Keep it for compatibility while new GitOps releases migrate to the split charts under `release-charts/`.
|
|
|
|
## Recommended Split Charts
|
|
|
|
Use these charts for new Argo CD Applications:
|
|
|
|
- `release-charts/mixingx-platform` - central platform services.
|
|
- `release-charts/mixingx-edge-unit` - one edge unit per Helm release.
|
|
- `release-charts/mixingx-agent-unit` - one agent unit per Helm release.
|
|
|
|
The root chart remains available for old CI/manual Helm flows, but new deployments should prefer the split release boundary so platform upgrades do not prune customer-added edge/agent units.
|
|
|
|
MixingX 全栈部署 Helm Chart(替代 Aspire publish 生成器)。
|
|
|
|
- **name**: `mixingx`
|
|
- **version**: 1.2.0
|
|
- **appVersion**: 1.0.1
|
|
|
|
本仓库以 git submodule 形式挂载在 [mixingx.hub](https://gitee.com/mixing-tech/mixingx.hub) 的 `mixingx-chart/` 路径下。CI(Drone)和本地 `helm` 命令都通过这个路径访问,改路径名会破坏部署链路。
|
|
|
|
## 架构:4 种服务类型
|
|
|
|
| 类型 | 服务 | 特点 | 数据源 |
|
|
|---|---|---|---|
|
|
| **A 四胞胎** | agent / edge | 后端+前端+独立DB,podAffinity 强制同节点 | `agents` / `edges` 数组 |
|
|
| **B standalones** | sso / ultra | 后端+前端+独立DB,无亲和,多副本 | `standalones` 数组 |
|
|
| **C 无DB** | gateway / audit | 单后端(gateway 带 RBAC;audit 连 Mongo) | `gateway` / `audit` 块 |
|
|
| **D 共享基础设施** | redis / mongo / rabbitmq | StatefulSet+PVC,所有服务共用 | `sharedDatastores` 数组 |
|
|
|
|
每个有 DB 的服务各自独立 postgres(StatefulSet),连接串指向 `{name}-postgres-service`。
|
|
|
|
## 三层调度优先级
|
|
|
|
每个 Pod 的 `spec` 按以下优先级**只取一层**:
|
|
|
|
```
|
|
1. nodeName 直接指定节点(最高,跳过 scheduler)
|
|
2. pointAffinity 点位级 nodeAffinity(覆盖全局 tier)
|
|
3. tier 全局档位调度(tier.enabled=true 才生效)
|
|
4. 无 兜底,随便调度
|
|
```
|
|
|
|
- **nodeName**:点位对象 `{site, nodeName}` → 跳过 scheduler。⚠️ 配合 local-path WaitForFirstConsumer 会触发 PVC 死循环(k8s#89953),生产建议用 nodeAffinity+label。
|
|
- **pointAffinity**:点位对象 `{site, nodeAffinity: {required?, preferred?}}` → 原生 nodeAffinity,由 kube-node OpsPage 点位对话框编辑。
|
|
- **tier**:给节点打 `mixingx.io/tier=infra|perf|edge` label,服务按角色声明要去哪档(`required` 硬约束 / `preferred` 软约束)。
|
|
|
|
前端/PG 因要和后端 podAffinity 同节点,合并 podAffinity + nodeAffinity 到同一个 `affinity:` 块(见 `_tier-affinity.tpl` / `_point-affinity.tpl` 的 NodeAffinity 变体)。
|
|
|
|
## 模板结构
|
|
|
|
```
|
|
templates/
|
|
├── _helpers.tpl # 镜像名/标签/服务发现标签
|
|
├── _backend.tpl # 后端三件套(Deployment+Service+ConfigMap+Secret)
|
|
├── _frontend.tpl # 前端两件套(Deployment+Service)
|
|
├── _postgres.tpl # 独立 PG(StatefulSet+Service+PVC)
|
|
├── _tier-affinity.tpl # 全局 tier 调度(最底层)
|
|
├── _point-affinity.tpl # 点位 nodeAffinity(中层)
|
|
├── instances.yaml # 🔁 遍历 agents/edges → 调用三个公共模板
|
|
├── standalones.yaml # 🔁 遍历 standalones(sso/ultra)
|
|
├── backend-gateway.yaml # gateway(单例,带 RBAC)
|
|
├── audit.yaml # audit(独立模板,连 Mongo)
|
|
├── shared-infra.yaml # 🔁 redis/mongo/rabbitmq
|
|
├── mock.yaml # 🔁 协议模拟器
|
|
├── dashboard.yaml # Aspire OTLP Dashboard
|
|
├── pgadmin.yaml # pgAdmin + 独立 Ingress
|
|
├── app-ingress.yaml # 业务总 Ingress(→ gateway)
|
|
└── gateway-rbac.yaml # gateway SA + Role + RoleBinding
|
|
```
|
|
|
|
## 使用
|
|
|
|
### 打包发布
|
|
|
|
```bash
|
|
helm package . --version 1.2.0 # 生成 mixingx-1.2.0.tgz
|
|
# 上传到 kube-node 工具的 /charts 页(agents/edges 新格式门禁)
|
|
```
|
|
|
|
### 部署(Drone CI 链路)
|
|
|
|
CI 用相对路径 `./mixingx-chart`(submodule 同名),values 覆盖用 `values-105.yaml`:
|
|
|
|
```bash
|
|
helm upgrade --install production ./mixingx-chart \
|
|
-f mixingx-chart/values-105.yaml \
|
|
--set tag=<镜像tag> \
|
|
--kube-context ctx-105 --namespace mixingx --create-namespace
|
|
```
|
|
|
|
### 验证渲染
|
|
|
|
```bash
|
|
helm lint .
|
|
helm template test . | grep -E "^kind:" | sort | uniq -c
|
|
# 默认:23 Service / 16 Deployment / 7 StatefulSet / 5 Secret / 5 ConfigMap / 2 Ingress + SA/Role/RoleBinding
|
|
```
|
|
|
|
## 关联文档
|
|
|
|
部署链路、kube-node 工具、tier 设计详见 hub 仓库:
|
|
|
|
- hub [AGENTS.md](https://gitee.com/mixing-tech/mixingx.hub) — 全项目指南
|
|
- `docs/superpowers/specs/2026-07-01-node-tier-affinity-design.md` — 三层调度设计
|
|
- `docs/superpowers/specs/2026-07-01-node-tier-affinity-playbook.md` — 操作手册(流程图+场景速查)
|