feat(edge-unit): 去 PostgreSQL + Edge Secret 只读挂载 + data PVC
This commit is contained in:
1 parent
08ed1422fe
commit
5d51b2e1de
9 files changed
+115
-104
No files matched your search
@@ -24,12 +24,12 @@ MixingX 全栈部署 Helm Chart(替代 Aspire publish 生成器)。
|
|||||||
|
|
||||||
| 类型 | 服务 | 特点 | 数据源 |
|
| 类型 | 服务 | 特点 | 数据源 |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| **A 四胞胎** | agent / edge | 后端+前端+独立DB,podAffinity 强制同节点 | `agents` / `edges` 数组 |
|
| **A 点位单元** | agent / edge | Agent 为后端+前端+独立DB;Edge 为后端+前端+本地修订存储 | `agents` / `edges` 数组 |
|
||||||
| **B standalones** | sso / ultra | 后端+前端+独立DB,无亲和,多副本 | `standalones` 数组 |
|
| **B standalones** | sso / ultra | 后端+前端+独立DB,无亲和,多副本 | `standalones` 数组 |
|
||||||
| **C 无DB** | gateway / audit | 单后端(gateway 带 RBAC;audit 连 Mongo) | `gateway` / `audit` 块 |
|
| **C 无DB** | gateway / audit | 单后端(gateway 带 RBAC;audit 连 Mongo) | `gateway` / `audit` 块 |
|
||||||
| **D 共享基础设施** | redis / mongo / rabbitmq | StatefulSet+PVC,所有服务共用 | `sharedDatastores` 数组 |
|
| **D 共享基础设施** | redis / mongo / rabbitmq | StatefulSet+PVC,所有服务共用 | `sharedDatastores` 数组 |
|
||||||
|
|
||||||
每个有 DB 的服务各自独立 postgres(StatefulSet),连接串指向 `{name}-postgres-service`。
|
Agent、SSO、Ultra 各自使用独立 PostgreSQL。Edge 不生成 PostgreSQL workload、Service、Secret、连接串或数据库 PVC。
|
||||||
|
|
||||||
## 三层调度优先级
|
## 三层调度优先级
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ MixingX 全栈部署 Helm Chart(替代 Aspire publish 生成器)。
|
|||||||
- **pointAffinity**:点位对象 `{site, nodeAffinity: {required?, preferred?}}` → 原生 nodeAffinity,由 kube-node OpsPage 点位对话框编辑。
|
- **pointAffinity**:点位对象 `{site, nodeAffinity: {required?, preferred?}}` → 原生 nodeAffinity,由 kube-node OpsPage 点位对话框编辑。
|
||||||
- **tier**:给节点打 `mixingx.io/tier=infra|perf|edge` label,服务按角色声明要去哪档(`required` 硬约束 / `preferred` 软约束)。
|
- **tier**:给节点打 `mixingx.io/tier=infra|perf|edge` label,服务按角色声明要去哪档(`required` 硬约束 / `preferred` 软约束)。
|
||||||
|
|
||||||
前端/PG 因要和后端 podAffinity 同节点,合并 podAffinity + nodeAffinity 到同一个 `affinity:` 块(见 `_tier-affinity.tpl` / `_point-affinity.tpl` 的 NodeAffinity 变体)。
|
前端以及需要数据库的服务 PG 与后端使用 podAffinity;Edge 只有前端与后端需要同节点调度。
|
||||||
|
|
||||||
## 模板结构
|
## 模板结构
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ templates/
|
|||||||
├── _postgres.tpl # 独立 PG(StatefulSet+Service+PVC)
|
├── _postgres.tpl # 独立 PG(StatefulSet+Service+PVC)
|
||||||
├── _tier-affinity.tpl # 全局 tier 调度(最底层)
|
├── _tier-affinity.tpl # 全局 tier 调度(最底层)
|
||||||
├── _point-affinity.tpl # 点位 nodeAffinity(中层)
|
├── _point-affinity.tpl # 点位 nodeAffinity(中层)
|
||||||
├── instances.yaml # 🔁 遍历 agents/edges → 调用三个公共模板
|
├── instances.yaml # 🔁 遍历 agents/edges;仅 Agent 调用 PostgreSQL 模板
|
||||||
├── standalones.yaml # 🔁 遍历 standalones(sso/ultra)
|
├── standalones.yaml # 🔁 遍历 standalones(sso/ultra)
|
||||||
├── backend-gateway.yaml # gateway(单例,带 RBAC)
|
├── backend-gateway.yaml # gateway(单例,带 RBAC)
|
||||||
├── audit.yaml # audit(独立模板,连 Mongo)
|
├── audit.yaml # audit(独立模板,连 Mongo)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
name: mixingx-edge-unit
|
name: mixingx-edge-unit
|
||||||
description: "One MixingX edge unit release: edge backend, edge web, and edge PostgreSQL."
|
description: "One MixingX edge unit release with durable local revision storage."
|
||||||
type: application
|
type: application
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
appVersion: "1.0.1"
|
appVersion: "1.0.1"
|
||||||
@@ -4,7 +4,7 @@ Deploys one edge site as one Helm release:
|
|||||||
|
|
||||||
- `edge-<site>` backend
|
- `edge-<site>` backend
|
||||||
- `edge-web-<site>` frontend
|
- `edge-web-<site>` frontend
|
||||||
- `edge-<site>-postgres` StatefulSet and retained PVC
|
- `edge-<site>-data` retained PVC for immutable configuration revisions and the command journal
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
{{- printf "%s-web-%s" .Values.role (.Values.site | toString) -}}
|
{{- printf "%s-web-%s" .Values.role (.Values.site | toString) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "mixingx-unit.database" -}}
|
|
||||||
{{- .Values.database | default (printf "%s-db-%s" .Values.role (.Values.site | toString)) -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "mixingx-unit.serviceId" -}}
|
{{- define "mixingx-unit.serviceId" -}}
|
||||||
{{- .Values.serviceId | default (include "mixingx-unit.name" .) -}}
|
{{- .Values.serviceId | default (include "mixingx-unit.name" .) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
{{- $name := include "mixingx-unit.name" . -}}
|
{{- $name := include "mixingx-unit.name" . -}}
|
||||||
{{- $webName := include "mixingx-unit.webName" . -}}
|
{{- $webName := include "mixingx-unit.webName" . -}}
|
||||||
{{- $database := include "mixingx-unit.database" . -}}
|
|
||||||
{{- $serviceId := include "mixingx-unit.serviceId" . -}}
|
{{- $serviceId := include "mixingx-unit.serviceId" . -}}
|
||||||
{{- $basePath := include "mixingx-unit.basePath" . -}}
|
{{- $basePath := include "mixingx-unit.basePath" . -}}
|
||||||
{{- $pgHost := printf "%s-postgres-service" $name -}}
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}-data
|
||||||
|
{{- if .Values.storage.keep }}
|
||||||
|
annotations:
|
||||||
|
helm.sh/resource-policy: keep
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
accessModes: ["ReadWriteOnce"]
|
||||||
|
storageClassName: {{ include "mixingx-unit.storageClassName" . }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.storage.size }}
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -24,6 +36,15 @@ spec:
|
|||||||
app.kubernetes.io/component: {{ $name }}
|
app.kubernetes.io/component: {{ $name }}
|
||||||
spec:
|
spec:
|
||||||
{{ include "mixingx-unit.backendScheduling" . | nindent 6 }}
|
{{ include "mixingx-unit.backendScheduling" . | nindent 6 }}
|
||||||
|
volumes:
|
||||||
|
- name: edge-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ $name }}-data
|
||||||
|
{{- range $index, $secret := .Values.edgeSecrets.mounts }}
|
||||||
|
- name: edge-secret-{{ $index }}
|
||||||
|
secret:
|
||||||
|
secretName: {{ required "edgeSecrets.mounts[].secretName is required" $secret.secretName | quote }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ $name }}
|
- name: {{ $name }}
|
||||||
{{ $backendImg := .Values.images.backend }}
|
{{ $backendImg := .Values.images.backend }}
|
||||||
@@ -44,6 +65,22 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: TZ
|
- name: TZ
|
||||||
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
|
||||||
|
- name: EdgeData__Root
|
||||||
|
value: /var/lib/mixingx-edge
|
||||||
|
- name: EdgeIdentity__NodeId
|
||||||
|
value: {{ $name | quote }}
|
||||||
|
- name: EdgeIdentity__IdWorkerId
|
||||||
|
value: {{ required "idWorkerId is required for an Edge unit" .Values.idWorkerId | quote }}
|
||||||
|
- name: EdgeSecrets__Root
|
||||||
|
value: {{ .Values.edgeSecrets.root | quote }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: edge-data
|
||||||
|
mountPath: /var/lib/mixingx-edge
|
||||||
|
{{- range $index, $secret := .Values.edgeSecrets.mounts }}
|
||||||
|
- name: edge-secret-{{ $index }}
|
||||||
|
mountPath: {{ printf "%s/%s" $.Values.edgeSecrets.root (required "edgeSecrets.mounts[].name is required" $secret.name) | quote }}
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@@ -89,9 +126,6 @@ data:
|
|||||||
HTTP_PORTS: "{{ .Values.ports.backend }}"
|
HTTP_PORTS: "{{ .Values.ports.backend }}"
|
||||||
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
|
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
|
||||||
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
|
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
|
||||||
POSTGRESQL_HOST: "{{ $pgHost }}"
|
|
||||||
POSTGRESQL_PORT: "{{ .Values.sharedInfra.postgres.port }}"
|
|
||||||
POSTGRESQL_USERNAME: "{{ .Values.sharedInfra.postgres.username }}"
|
|
||||||
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
|
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
|
||||||
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
|
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||||
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
|
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
|
||||||
@@ -111,10 +145,6 @@ stringData:
|
|||||||
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
|
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
|
||||||
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
|
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
|
||||||
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
|
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
|
||||||
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ .Values.sharedInfra.postgres.port }};Username={{ .Values.sharedInfra.postgres.username }};Password={{ .Values.sharedInfra.postgres.password }};Database={{ $database }}"
|
|
||||||
POSTGRESQL_PASSWORD: "{{ .Values.sharedInfra.postgres.password }}"
|
|
||||||
POSTGRESQL_URI: "postgresql://{{ .Values.sharedInfra.postgres.username }}:{{ .Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ .Values.sharedInfra.postgres.port }}/{{ $database }}"
|
|
||||||
POSTGRESQL_DATABASENAME: "{{ $database }}"
|
|
||||||
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||||
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
|
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
|
||||||
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
|
||||||
@@ -175,72 +205,4 @@ spec:
|
|||||||
port: {{ .Values.ports.frontend }}
|
port: {{ .Values.ports.frontend }}
|
||||||
targetPort: http
|
targetPort: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
---
|
|
||||||
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
|
|
||||||
{{- if .Values.storage.keep }}
|
|
||||||
annotations:
|
|
||||||
helm.sh/resource-policy: keep
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
accessModes: ["ReadWriteOnce"]
|
|
||||||
storageClassName: {{ include "mixingx-unit.storageClassName" . }}
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.storage.size }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/component: {{ $name }}-postgres
|
|
||||||
spec:
|
|
||||||
{{ include "mixingx-unit.followerScheduling" . | nindent 6 }}
|
|
||||||
containers:
|
|
||||||
- name: postgres
|
|
||||||
image: {{ .Values.images.postgres.repository }}:{{ .Values.images.postgres.tag | default "latest" }}
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
env:
|
|
||||||
- name: POSTGRES_PASSWORD
|
|
||||||
value: "{{ .Values.sharedInfra.postgres.password }}"
|
|
||||||
- name: POSTGRES_DB
|
|
||||||
value: "{{ $database }}"
|
|
||||||
- name: POSTGRES_USER
|
|
||||||
value: "{{ .Values.sharedInfra.postgres.username }}"
|
|
||||||
- name: PGDATA
|
|
||||||
value: /var/lib/postgresql/data/pgdata
|
|
||||||
ports:
|
|
||||||
- name: tcp
|
|
||||||
containerPort: {{ .Values.ports.postgres }}
|
|
||||||
protocol: TCP
|
|
||||||
volumeMounts:
|
|
||||||
- name: data
|
|
||||||
mountPath: /var/lib/postgresql/data
|
|
||||||
---
|
|
||||||
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: {{ .Values.ports.postgres }}
|
|
||||||
targetPort: tcp
|
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
@@ -6,7 +6,7 @@ role: edge
|
|||||||
site: "0"
|
site: "0"
|
||||||
description: "Edge 实例 0"
|
description: "Edge 实例 0"
|
||||||
serviceId: ""
|
serviceId: ""
|
||||||
database: ""
|
idWorkerId: 17
|
||||||
|
|
||||||
images:
|
images:
|
||||||
backend:
|
backend:
|
||||||
@@ -15,30 +15,30 @@ images:
|
|||||||
frontend:
|
frontend:
|
||||||
repository: edge-web
|
repository: edge-web
|
||||||
tag: ""
|
tag: ""
|
||||||
postgres:
|
|
||||||
repository: docker.io/library/postgres
|
|
||||||
tag: "17"
|
|
||||||
edge: {}
|
edge: {}
|
||||||
edgeWeb: {}
|
edgeWeb: {}
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
backend: 8080
|
backend: 8080
|
||||||
frontend: 80
|
frontend: 80
|
||||||
postgres: 5432
|
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
className: local-path
|
className: local-path
|
||||||
size: 5Gi
|
size: 5Gi
|
||||||
keep: true
|
keep: true
|
||||||
|
|
||||||
|
# SecretRef { name, key } resolves to <root>/<name>/<key>.
|
||||||
|
# Each mount projects one existing Kubernetes Secret; its data keys become files.
|
||||||
|
edgeSecrets:
|
||||||
|
root: /var/run/secrets/mixingx-edge
|
||||||
|
mounts: []
|
||||||
|
# - name: plc-main
|
||||||
|
# secretName: edge-0-plc-main
|
||||||
|
|
||||||
nodeName: ""
|
nodeName: ""
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
|
||||||
username: postgres
|
|
||||||
password: "Admin12345"
|
|
||||||
port: 5432
|
|
||||||
redis:
|
redis:
|
||||||
host: redis-service
|
host: redis-service
|
||||||
port: 6379
|
port: 6379
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
replicas - 副本数(默认 1)
|
replicas - 副本数(默认 1)
|
||||||
serviceId - 业务身份(可选)
|
serviceId - 业务身份(可选)
|
||||||
database - 数据库名(有则生成 PG 连接串,指向 {name}-postgres-service)
|
database - 数据库名(有则生成 PG 连接串,指向 {name}-postgres-service)
|
||||||
|
edgeData - Edge 本地配置修订 PVC(可选)
|
||||||
|
edgeIdWorker - Edge Snowflake worker id(edgeData=true 时使用)
|
||||||
rbac - 是否需要 serviceAccount(只有 gateway)
|
rbac - 是否需要 serviceAccount(只有 gateway)
|
||||||
description - 中文展示名(可选,写为 mixingx.io/description annotation)
|
description - 中文展示名(可选,写为 mixingx.io/description annotation)
|
||||||
root - $ (root context)
|
root - $ (root context)
|
||||||
@@ -48,6 +50,17 @@ spec:
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
{{ include "mixingx.tierAffinity" (dict "role" .role "root" .root) }}
|
{{ include "mixingx.tierAffinity" (dict "role" .role "root" .root) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .edgeData }}
|
||||||
|
volumes:
|
||||||
|
- name: edge-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ .name }}-data
|
||||||
|
{{- range $index, $secret := $root.Values.edgeSecrets.mounts }}
|
||||||
|
- name: edge-secret-{{ $index }}
|
||||||
|
secret:
|
||||||
|
secretName: {{ required "edgeSecrets.mounts[].secretName is required" $secret.secretName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .name }}
|
- name: {{ .name }}
|
||||||
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
|
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
|
||||||
@@ -65,12 +78,32 @@ spec:
|
|||||||
# 时区(部署地域覆盖,优先级 > 镜像内 /etc/localtime)
|
# 时区(部署地域覆盖,优先级 > 镜像内 /etc/localtime)
|
||||||
- name: TZ
|
- name: TZ
|
||||||
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||||||
|
{{- if .edgeData }}
|
||||||
|
- name: EdgeData__Root
|
||||||
|
value: /var/lib/mixingx-edge
|
||||||
|
- name: EdgeIdentity__NodeId
|
||||||
|
value: {{ .name | quote }}
|
||||||
|
- name: EdgeIdentity__IdWorkerId
|
||||||
|
value: {{ .edgeIdWorker | quote }}
|
||||||
|
- name: EdgeSecrets__Root
|
||||||
|
value: {{ $root.Values.edgeSecrets.root | quote }}
|
||||||
|
{{- end }}
|
||||||
{{- if .rbac }}
|
{{- if .rbac }}
|
||||||
- name: POD_NAMESPACE
|
- name: POD_NAMESPACE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .edgeData }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: edge-data
|
||||||
|
mountPath: /var/lib/mixingx-edge
|
||||||
|
{{- range $index, $secret := $root.Values.edgeSecrets.mounts }}
|
||||||
|
- name: edge-secret-{{ $index }}
|
||||||
|
mountPath: {{ printf "%s/%s" $root.Values.edgeSecrets.root (required "edgeSecrets.mounts[].name is required" $secret.name) | quote }}
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
@@ -126,9 +159,11 @@ data:
|
|||||||
HTTP_PORTS: "{{ $port }}"
|
HTTP_PORTS: "{{ $port }}"
|
||||||
REDIS_HOST: "{{ $root.Values.sharedInfra.redis.host }}"
|
REDIS_HOST: "{{ $root.Values.sharedInfra.redis.host }}"
|
||||||
REDIS_PORT: "{{ $root.Values.sharedInfra.redis.port }}"
|
REDIS_PORT: "{{ $root.Values.sharedInfra.redis.port }}"
|
||||||
|
{{- if .database }}
|
||||||
POSTGRESQL_HOST: "{{ $pgHost }}"
|
POSTGRESQL_HOST: "{{ $pgHost }}"
|
||||||
POSTGRESQL_PORT: "{{ $root.Values.sharedInfra.postgres.port }}"
|
POSTGRESQL_PORT: "{{ $root.Values.sharedInfra.postgres.port }}"
|
||||||
POSTGRESQL_USERNAME: "{{ $root.Values.sharedInfra.postgres.username }}"
|
POSTGRESQL_USERNAME: "{{ $root.Values.sharedInfra.postgres.username }}"
|
||||||
|
{{- end }}
|
||||||
MESSAGING_HOST: "{{ $root.Values.sharedInfra.rabbitmq.host }}"
|
MESSAGING_HOST: "{{ $root.Values.sharedInfra.rabbitmq.host }}"
|
||||||
MESSAGING_PORT: "{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
MESSAGING_PORT: "{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
||||||
MESSAGING_USERNAME: "{{ $root.Values.sharedInfra.rabbitmq.username }}"
|
MESSAGING_USERNAME: "{{ $root.Values.sharedInfra.rabbitmq.username }}"
|
||||||
|
|||||||
@@ -29,9 +29,9 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Edge 点位 — 遍历 .Values.edges 数组,逻辑同上
|
Edge 点位 — 遍历 .Values.edges 数组,仅生成后端与前端;配置历史使用 Edge 本地持久卷,不生成 PostgreSQL
|
||||||
*/}}
|
*/}}
|
||||||
{{- range $raw := .Values.edges }}
|
{{- range $edgeIndex, $raw := .Values.edges }}
|
||||||
{{- $site := "" -}}
|
{{- $site := "" -}}
|
||||||
{{- $nodeName := "" -}}
|
{{- $nodeName := "" -}}
|
||||||
{{- $pointAffinity := "" -}}
|
{{- $pointAffinity := "" -}}
|
||||||
@@ -44,11 +44,21 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $instName := printf "edge-%s" $site }}
|
{{- $instName := printf "edge-%s" $site }}
|
||||||
{{- $webName := printf "edge-web-%s" $site }}
|
{{- $webName := printf "edge-web-%s" $site }}
|
||||||
{{- $dbName := printf "edge-db-%s" $site }}
|
|
||||||
{{- $basePath := printf "/edge-%s" $site }}
|
{{- $basePath := printf "/edge-%s" $site }}
|
||||||
{{- $description := printf "Edge 实例 %s" $site }}
|
{{- $description := printf "Edge 实例 %s" $site }}
|
||||||
# ═══ 实例: {{ $instName }} ({{ $description }}) ═══
|
# ═══ 实例: {{ $instName }} ({{ $description }}) ═══
|
||||||
{{ include "mixingx.backend" (dict "name" $instName "image" "edge" "role" "edge" "serviceId" $instName "database" $dbName "description" $description "nodeName" $nodeName "pointAffinity" $pointAffinity "root" $) }}
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ $instName }}-data
|
||||||
|
annotations:
|
||||||
|
helm.sh/resource-policy: keep
|
||||||
|
spec:
|
||||||
|
accessModes: ["ReadWriteOnce"]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
|
{{ include "mixingx.backend" (dict "name" $instName "image" "edge" "role" "edge" "serviceId" $instName "edgeData" true "edgeIdWorker" (add 17 $edgeIndex) "description" $description "nodeName" $nodeName "pointAffinity" $pointAffinity "root" $) }}
|
||||||
{{ include "mixingx.frontend" (dict "name" $webName "image" "edge-web" "basePath" $basePath "affinity" $instName "nodeName" $nodeName "pointAffinity" $pointAffinity "tierRole" "edge" "root" $) }}
|
{{ include "mixingx.frontend" (dict "name" $webName "image" "edge-web" "basePath" $basePath "affinity" $instName "nodeName" $nodeName "pointAffinity" $pointAffinity "tierRole" "edge" "root" $) }}
|
||||||
{{ include "mixingx.postgres" (dict "name" $instName "database" $dbName "pgStorage" "5Gi" "affinity" true "nodeName" $nodeName "pointAffinity" $pointAffinity "tierRole" "edge" "root" $) }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
+11
-3
@@ -37,8 +37,8 @@ sharedInfra:
|
|||||||
protocol: grpc
|
protocol: grpc
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════
|
||||||
# 类型 A:四胞胎(agent/edge)— 后端+前端+独立DB,podAffinity 同节点
|
# 类型 A:点位单元(agent/edge)— Agent 带独立 DB;Edge 带本地配置修订 PVC
|
||||||
# 每个实例生成:后端 Deployment + 前端 Deployment + 独立 postgres StatefulSet
|
# Agent 实例生成后端、前端与独立 PostgreSQL;Edge 实例仅生成后端与前端。
|
||||||
# 默认各 1 个,以后按需加(加一行 values + helm upgrade)
|
# 默认各 1 个,以后按需加(加一行 values + helm upgrade)
|
||||||
# ═══════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════
|
||||||
# ═══════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════
|
||||||
@@ -47,7 +47,7 @@ sharedInfra:
|
|||||||
# 生成规则:
|
# 生成规则:
|
||||||
# 后端: {role}-{site} 如 agent-0, agent-beijing
|
# 后端: {role}-{site} 如 agent-0, agent-beijing
|
||||||
# 前端: {role}-web-{site} 如 agent-web-0, agent-web-beijing
|
# 前端: {role}-web-{site} 如 agent-web-0, agent-web-beijing
|
||||||
# 数据库: {role}-db-{site} 如 agent-db-0, agent-db-beijing
|
# 数据库: 仅 Agent 生成 {role}-db-{site}
|
||||||
# basePath: /{role}-{site} 如 /agent-0, /agent-beijing
|
# basePath: /{role}-{site} 如 /agent-0, /agent-beijing
|
||||||
# ═══════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
@@ -60,6 +60,14 @@ edges:
|
|||||||
- "0"
|
- "0"
|
||||||
# - guangzhou
|
# - guangzhou
|
||||||
|
|
||||||
|
# Edge SecretRef { name, key } resolves to <root>/<name>/<key>.
|
||||||
|
# Each entry mounts one existing Kubernetes Secret read-only into every Edge unit.
|
||||||
|
edgeSecrets:
|
||||||
|
root: /var/run/secrets/mixingx-edge
|
||||||
|
mounts: []
|
||||||
|
# - name: plc-main
|
||||||
|
# secretName: edge-plc-main
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════
|
||||||
# 节点档位调度(可选)— 按硬件能力把服务分配到相应 node
|
# 节点档位调度(可选)— 按硬件能力把服务分配到相应 node
|
||||||
# 前提:给集群节点打 label kubectl label node <name> mixingx.io/tier=<infra|perf|edge>
|
# 前提:给集群节点打 label kubectl label node <name> mixingx.io/tier=<infra|perf|edge>
|
||||||
|
|||||||
Reference in new issue
Block a user