Files
mixingx.hub.chart/templates/_frontend.tpl
T
ximenchuifeng f69c4161b5 feat: CI/CD 全链路(Drone pipeline + Helm chart + Dockerfile)
重大变更:
- .drone.yml: 4 步 pipeline(submodule init → build 12 镜像 → helm deploy → verify)
- mixingx-chart/: 手写 Helm chart(模式 3,替代 aspire publish)
  - 独立 postgres(每服务一个,不再共享)
  - 四胞胎架构(agent/edge: 后端+前端+DB podAffinity 同节点)
  - pgAdmin(在 K3s 内,管理所有 postgres)
  - Aspire Dashboard(OTLP 遥测接收端)
- Dockerfile: 全部服务已补齐(含 gateway/audit 新增)
- apphost.cs: opcua mock publish 模式改 AddDockerfile
- patch-persistence.sh: emptyDir → PVC patch(备用)

submodule 指针更新:
- mixingx.sso: Dockerfile 精准 COPY
- mixingx.edge: opcua Dockerfile 新增
- eau.ultra: MigrateAsync 无条件执行
- mixingx.audit: Dockerfile 新增
- mixingx.gateway: Dockerfile 新增

镜像 tag 规则: {分支}-{时间戳}-[{tag}]
2026-06-24 18:06:37 +08:00

80 lines
2.1 KiB
Smarty

{{/*
公共模板:前端 Deployment + Service
可选 podAffinity(四胞胎用:前端和后端同节点)
参数:
name - 服务名(agent-web-0 / sso-web ...)
image - 镜像名
port - 端口(默认 80)
basePath - vite base path
affinity - 要亲和的目标服务名(如 "agent-0"),空则不配亲和
root - $ (root context)
*/}}
{{- define "mixingx.frontend" -}}
{{- $root := .root -}}
{{- $port := .port | default 80 -}}
---
# Deployment: {{ .name }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .name }}-deployment
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/component: {{ .name }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: {{ .name }}
template:
metadata:
labels:
app.kubernetes.io/component: {{ .name }}
spec:
{{- if .affinity }}
# 四胞胎:前端必须和后端同节点
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/component: {{ .affinity }}
topologyKey: kubernetes.io/hostname
{{- end }}
containers:
- name: {{ .name }}
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: {{ $port }}
protocol: TCP
env:
- name: VITE_BASE_PATH
value: "{{ .basePath }}"
- name: PORT
value: "{{ $port }}"
---
# Service: {{ .name }}
apiVersion: v1
kind: Service
metadata:
name: {{ .name }}-service
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/component: {{ .name }}
mixingx.io/role: web
mixingx.io/node-id: {{ .name }}
spec:
selector:
app.kubernetes.io/component: {{ .name }}
ports:
- name: http
port: {{ $port }}
targetPort: http
protocol: TCP
{{- end -}}