Compare commits

..
Author SHA1 Message Date
ximenchuifeng ceeb5474a9 feat(gateway): 更新中心集群支撑——prepull Role + ArgoCD 配置可选注入(暂驻分支不合并)
- gateway-rbac 追加 gateway-prepull-manager Role/RoleBinding(daemonsets
  增删查 + pods 只读,挂既有 gateway-sa):更新中心预拉取 DS 编排所需
- gateway Deployment 支持可选注入 gateway.updateCenter.argocdUrl /
  argocdTokenSecret → env Update__ArgoCd__*(缺省不注入 = 清单功能 503 降级)
2026-09-09 07:54:13 +08:00
17 changed files with 76 additions and 50 deletions

No files matched your search

+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-agent-unit
description: "One MixingX agent unit release: agent backend, agent web, and agent PostgreSQL."
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.3
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-audit
description: MixingX audit service.
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-edge-unit
description: "One MixingX edge unit release with durable local revision storage."
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-gateway
description: MixingX gateway service, RBAC, and root ingress.
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
@@ -33,4 +33,34 @@ roleRef:
subjects:
- kind: ServiceAccount
name: gateway-sa
---
# 更新中心(ADR-0074 决策 7):预拉取 DaemonSet 编排——镜像提前铺到各节点,
# 客户点更新时新 Pod 命中本地缓存秒级切换。权限只有 daemonsets 增删查 + pods 只读。
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: gateway-prepull-manager
labels:
app.kubernetes.io/component: gateway
rules:
- apiGroups: ["apps"]
resources: ["daemonsets"]
verbs: ["create", "get", "list", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: gateway-prepull-manager-binding
labels:
app.kubernetes.io/component: gateway
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: gateway-prepull-manager
subjects:
- kind: ServiceAccount
name: gateway-sa
{{- end }}
@@ -52,6 +52,20 @@ spec:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
{{- /* 更新中心(ADR-0074):ArgoCD 只读访问(镜像清单);缺省不注入 = 清单功能 503 降级 */}}
{{- with .Values.gateway.updateCenter }}
{{- with .argocdUrl }}
- name: Update__ArgoCd__BaseUrl
value: {{ . | quote }}
{{- end }}
{{- with .argocdTokenSecret }}
- name: Update__ArgoCd__Token
valueFrom:
secretKeyRef:
name: {{ .name | quote }}
key: {{ .key | default "token" | quote }}
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /health
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-infra
description: MixingX shared infrastructure services (Redis, MongoDB, RabbitMQ).
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-mqttx
description: MixingX MQTTX Web — 浏览器端 MQTT 客户端,用于监控/调试各 Edge 的 NanoMQ broker。
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-network-agent
description: "MixingX network console agent: 每节点常驻,提供主机网口(IP/掩码/网关/DNS)与 WiFi 的可视化配置 API。"
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 0.1.0
appVersion: "1.0.1"
@@ -29,10 +29,6 @@ spec:
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: network-agent
image: {{ .Values.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}
@@ -55,10 +51,13 @@ spec:
- name: K3S_RESTART_ON_IP_CHANGE
value: {{ .Values.k3sRestartOnIpChange | quote }}
securityContext:
# 只需 root + D-Bus socket,无需 privileged 与额外 capability:
# nmcli 经 D-Bus 操作主机 NM,特权动作(改 IP/路由)全部由 NM 进程执行
# 只需 root + D-Bus socket,无需 privileged
# NET_ADMIN: 清除切换静态后残留的动态地址(ip addr del 需要此能力)
runAsUser: 0
allowPrivilegeEscalation: false
capabilities:
add:
- NET_ADMIN
livenessProbe:
httpGet:
path: /api/network/health
@@ -81,15 +80,15 @@ spec:
# 主机 system bus: nmcli 与 systemd 重启都走它
- name: dbus
mountPath: /run/dbus/system_bus_socket
# 网卡别名持久化: aliases.json 落宿主机,重启/重建 Pod 均保留
- name: alias-store
mountPath: /var/lib/mixingx/network-agent
- name: nm-run
mountPath: /run/NetworkManager
readOnly: true
volumes:
- name: dbus
hostPath:
path: /run/dbus/system_bus_socket
type: Socket
- name: alias-store
- name: nm-run
hostPath:
path: /var/lib/mixingx/network-agent
path: /run/NetworkManager
type: DirectoryOrCreate
@@ -1,8 +1,6 @@
# Headless 诊断服务: DNS network-agent 返回各节点 agent 的全部地址。
# 注意: 每个 agent 只管理自己所在节点,不要用普通 ClusterIP Service 访问
# (会在节点间随机负载均衡导致操作到错误的主机)。前端弹窗始终直连节点 IP。
# mixingx.io/role 标签让 Gateway 发现该服务并生成 /api/network/** 透传路由,
# 前端网络设置弹窗经 Gateway 同源转发访问(消除跨域)。
apiVersion: v1
kind: Service
metadata:
@@ -10,8 +8,6 @@ metadata:
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/component: network-agent
mixingx.io/role: network-agent
mixingx.io/node-id: network-agent
spec:
clusterIP: None
selector:
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-platform
description: MixingX central platform services without customer edge/agent instances.
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-protocol-server-unit
description: Deploy one MixingX edge protocol test server instance.
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-sso
description: MixingX SSO standalone release (backend, web, and PostgreSQL).
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
+2 -2
View File
@@ -2,5 +2,5 @@ apiVersion: v2
name: mixingx-ultra
description: "MixingX Ultra dashboard standalone release: ultra backend, ultra web, and ultra PostgreSQL."
type: application
version: 1.0.18
appVersion: "1.0.18"
version: 1.0.1
appVersion: "1.0.1"
-12
View File
@@ -9,8 +9,6 @@
# 4. 禁用 cloud-init 网络管理,netplan renderer 切换为 NetworkManager
# 5. rfkill 解锁无线网卡
# 6. 安装 polkit 放行规则(容器内 root 调用 NM/systemd D-Bus)
# 7. 禁止 NM 开机收编 initramfs 抢配的连接(keep-configuration=no),
# 确保开机按 autoconnect-priority 选路,静态档案不被绕过
#
# 用法: sudo bash provision-host.sh
# 回滚: sudo bash rollback-host.sh
@@ -43,16 +41,6 @@ cat > /etc/NetworkManager/conf.d/99-mixingx.conf <<'EOF'
no-auto-default=*
EOF
# 禁止 NM 开机收编 initramfs 阶段(dracut 遗留 DHCP 配置)抢配的现状:
# 默认 keep-configuration 走 connection-assumed,autoconnect-priority 选路不执行,
# 静态档案开机被绕过(表现为"重启后静态 IP 变回 DHCP")。
# 设为 no 后 NM 开机总是按最高 autoconnect-priority 激活持久档案;
# initrd 抢到的 DHCP 租约会以副地址共存(双 IP:静态主 + DHCP 副兜底)。
cat > /etc/NetworkManager/conf.d/98-keep-configuration.conf <<'EOF'
[device]
keep-configuration=no
EOF
systemctl enable --now NetworkManager >/dev/null 2>&1 || true
# ── 2. 识别主网口并读取当前参数 ───────────────────────────────────────────
-1
View File
@@ -42,7 +42,6 @@ systemctl disable --now NetworkManager >/dev/null 2>&1 || true
# ── 4. 移除 polkit 规则 / NM 覆盖配置 ─────────────────────────────────────
rm -f /etc/polkit-1/localauthority/50-local.d/49-mixingx-network-agent.pkla
rm -f /etc/NetworkManager/conf.d/99-mixingx.conf
rm -f /etc/NetworkManager/conf.d/98-keep-configuration.conf
sleep 3
ip -4 addr show | awk '/inet /{print " " $2 " @ " $NF}'