重大变更:
- .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}]
90 lines
2.5 KiB
Smarty
90 lines
2.5 KiB
Smarty
{{/*
|
|
公共模板:生成独立 postgres StatefulSet + Service + PVC
|
|
每个有 DB 的服务(agent/edge/sso/ultra)各自一个
|
|
|
|
参数:
|
|
name - 服务名(agent-0 / sso ...)
|
|
database - 数据库名(agent-db-0 / sso-db)
|
|
pgStorage - PVC 容量(默认 5Gi)
|
|
affinity - 是否需要和后端同节点(四胞胎用 true)
|
|
root - $ (root context)
|
|
*/}}
|
|
{{- define "mixingx.postgres" -}}
|
|
{{- $root := .root -}}
|
|
---
|
|
# StatefulSet: {{ .name }}-postgres
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ .name }}-postgres
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}-postgres
|
|
spec:
|
|
serviceName: {{ .name }}-postgres-service
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ .name }}-postgres
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: local-path
|
|
resources:
|
|
requests:
|
|
storage: {{ .pgStorage | default "5Gi" }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: {{ .name }}-postgres
|
|
spec:
|
|
{{- if .affinity }}
|
|
# 四胞胎:postgres 必须和后端 Pod 同节点
|
|
affinity:
|
|
podAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
topologyKey: kubernetes.io/hostname
|
|
{{- end }}
|
|
containers:
|
|
- name: postgres
|
|
image: docker.io/library/postgres:17
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: POSTGRES_PASSWORD
|
|
value: "{{ $root.Values.sharedInfra.postgres.password }}"
|
|
- name: POSTGRES_DB
|
|
value: "{{ .database }}"
|
|
- name: POSTGRES_USER
|
|
value: "{{ $root.Values.sharedInfra.postgres.username }}"
|
|
ports:
|
|
- name: tcp
|
|
containerPort: {{ $root.Values.sharedInfra.postgres.port }}
|
|
protocol: TCP
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
|
|
---
|
|
# Service: {{ .name }}-postgres-service
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ .name }}-postgres-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}-postgres
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: {{ .name }}-postgres
|
|
ports:
|
|
- name: tcp
|
|
port: {{ $root.Values.sharedInfra.postgres.port }}
|
|
targetPort: tcp
|
|
protocol: TCP
|
|
{{- end -}}
|