- 10 个 chart values 顶层加 imagePullSecrets: [](ADR-0066) - 27 处 Pod spec 注入 with 块;platform _workloads.tpl 用 $root 上下文 - 默认渲染与改动前 bit 级一致(helm template 验证);注入测试 10/10 通过 - delivery/image-manifest.yaml: 第三方镜像 ACR 核对清单(nanomq 为当前缺口)
137 lines
4.9 KiB
YAML
137 lines
4.9 KiB
YAML
{{- if .Values.audit.enabled }}
|
|
{{- $root := $ }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: audit-deployment
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: audit
|
|
spec:
|
|
replicas: {{ .Values.audit.replicas | default 2 }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: audit
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: audit
|
|
spec:
|
|
{{ include "mixingx-audit.tierAffinity" (dict "role" "audit" "root" $root) | nindent 6 }}
|
|
{{- with $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: audit
|
|
image: "{{ .Values.registry }}/{{ .Values.images.audit.repository | default "audit" }}:{{ .Values.images.audit.tag | default .Values.tag | default "latest" }}"
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.audit.port }}
|
|
protocol: TCP
|
|
env:
|
|
- name: TZ
|
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
|
- name: PORT
|
|
value: "{{ .Values.audit.port }}"
|
|
- name: HOST
|
|
value: "0.0.0.0"
|
|
# PostgreSQL — 凭据通过 Secret 注入
|
|
- name: AUDIT_PG_URI
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: audit-secrets
|
|
key: AUDIT_PG_URI
|
|
- name: AUDIT_PG_TIMEZONE
|
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
|
# 数据保留月数(按自然月清理分区)
|
|
- name: AUDIT_RETENTION_MONTHS
|
|
value: "{{ .Values.audit.retentionMonths | default 6 }}"
|
|
# MQTT broker
|
|
- name: AUDIT_MQTT_BROKER_URL
|
|
value: "mqtt://{{ .Values.audit.mqtt.brokerHost }}:{{ .Values.audit.mqtt.brokerPort }}"
|
|
# POD_NAME 供 config.ts 自动生成 mixingx-audit-sub-{podName} clientId
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: AUDIT_MQTT_SHARED_GROUP
|
|
value: "mixingx-audit"
|
|
# NanoMQ 管理 API — 凭据通过 Secret 注入
|
|
- name: AUDIT_MQTT_MANAGEMENT_URL
|
|
value: "http://{{ .Values.audit.mqtt.brokerHost }}:{{ .Values.audit.mqtt.managementPort }}"
|
|
- name: AUDIT_MQTT_MANAGEMENT_USERNAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: audit-secrets
|
|
key: AUDIT_MQTT_MANAGEMENT_USERNAME
|
|
- name: AUDIT_MQTT_MANAGEMENT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: audit-secrets
|
|
key: AUDIT_MQTT_MANAGEMENT_PASSWORD
|
|
# 消费队列/并发
|
|
- name: AUDIT_CONSUME_QUEUE_CAPACITY
|
|
value: "{{ .Values.audit.consume.queueCapacity }}"
|
|
- name: AUDIT_CONSUME_QUEUE_MAX_WAIT_MS
|
|
value: "{{ .Values.audit.consume.queueMaxWaitMs }}"
|
|
- name: AUDIT_DB_WRITE_TIMEOUT_MS
|
|
value: "{{ .Values.audit.consume.dbWriteTimeoutMs }}"
|
|
- name: AUDIT_CONSUME_CONCURRENCY
|
|
value: "{{ .Values.audit.consume.concurrency }}"
|
|
# JWT 鉴权:变量名沿用 JWT_JWKS_URI(代码契约),实际语义是 SSO base URL,
|
|
# 后端用它拼 /api/sso/users/info 间接校验 token
|
|
- name: JWT_JWKS_URI
|
|
value: "{{ .Values.audit.jwt.ssoBaseUrl }}"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health/live
|
|
port: http
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health/ready
|
|
port: http
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: audit-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: audit
|
|
mixingx.io/role: audit
|
|
mixingx.io/node-id: audit
|
|
annotations:
|
|
mixingx.io/description: "审计服务"
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: audit
|
|
ports:
|
|
- name: http
|
|
port: {{ .Values.audit.port }}
|
|
targetPort: http
|
|
protocol: TCP
|
|
---
|
|
# ===== Audit Secrets =====
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: audit-secrets
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: audit
|
|
type: Opaque
|
|
stringData:
|
|
AUDIT_PG_URI: "postgresql://{{ $root.Values.sharedInfra.postgres.username }}:{{ $root.Values.sharedInfra.postgres.password }}@{{ .Values.audit.database }}-postgres-service:{{ $root.Values.sharedInfra.postgres.port }}/{{ .Values.audit.database }}"
|
|
AUDIT_MQTT_MANAGEMENT_USERNAME: "{{ .Values.audit.mqtt.managementUsername }}"
|
|
AUDIT_MQTT_MANAGEMENT_PASSWORD: "{{ .Values.audit.mqtt.managementPassword }}"
|
|
{{- end }}
|