- 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 为当前缺口)
244 lines
8.1 KiB
YAML
244 lines
8.1 KiB
YAML
{{- $root := . -}}
|
|
{{- $cfg := .Values.ultra -}}
|
|
{{- $name := $cfg.name -}}
|
|
{{- $role := $cfg.role -}}
|
|
{{- $serviceId := $cfg.serviceId -}}
|
|
{{- $database := $cfg.database -}}
|
|
{{- $pgStorage := $cfg.pgStorage -}}
|
|
{{- $replicas := $cfg.replicas -}}
|
|
{{- $description := $cfg.description -}}
|
|
{{- $webBasePath := $cfg.webBasePath -}}
|
|
{{- $port := 8080 -}}
|
|
{{- $webPort := 80 -}}
|
|
{{- $pgHost := printf "%s-postgres-service" $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: {{ $replicas | default 2 }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ $name }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/config: {{ include "mixingx-ultra.configData" . | sha256sum }}
|
|
labels:
|
|
app.kubernetes.io/component: {{ $name }}
|
|
spec:
|
|
{{ include "mixingx-ultra.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
|
|
{{- with $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ $name }}
|
|
image: {{ $root.Values.registry }}/{{ $root.Values.images.ultra.repository | default "ultra" }}:{{ $root.Values.images.ultra.tag | default $root.Values.tag | default "latest" }}
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ $port }}
|
|
protocol: TCP
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{ $name }}-config
|
|
- secretRef:
|
|
name: {{ $name }}-secrets
|
|
env:
|
|
- name: TZ
|
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: http
|
|
initialDelaySeconds: 120
|
|
periodSeconds: 30
|
|
timeoutSeconds: 15
|
|
failureThreshold: 12
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /alive
|
|
port: http
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 30
|
|
timeoutSeconds: 10
|
|
failureThreshold: 8
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $name }}-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ $name }}
|
|
mixingx.io/role: {{ $role }}
|
|
mixingx.io/node-id: {{ $name }}
|
|
annotations:
|
|
mixingx.io/description: {{ $description | quote }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: {{ $name }}
|
|
ports:
|
|
- name: http
|
|
port: {{ $port }}
|
|
targetPort: http
|
|
protocol: TCP
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{ $name }}-config
|
|
data:
|
|
{{- include "mixingx-ultra.configData" . | nindent 2 }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ $name }}-secrets
|
|
type: Opaque
|
|
stringData:
|
|
ConnectionStrings__redis: "{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }},password={{ $root.Values.sharedInfra.redis.password }}"
|
|
REDIS_PASSWORD: "{{ $root.Values.sharedInfra.redis.password }}"
|
|
REDIS_URI: "redis://:{{ $root.Values.sharedInfra.redis.password }}@{{ $root.Values.sharedInfra.redis.host }}:{{ $root.Values.sharedInfra.redis.port }}"
|
|
ConnectionStrings__PostgreSQL: "Host={{ $pgHost }};Port={{ $root.Values.sharedInfra.postgres.port }};Username={{ $root.Values.sharedInfra.postgres.username }};Password={{ $root.Values.sharedInfra.postgres.password }};Database={{ $database }}"
|
|
POSTGRESQL_PASSWORD: "{{ $root.Values.sharedInfra.postgres.password }}"
|
|
POSTGRESQL_URI: "postgresql://{{ $root.Values.sharedInfra.postgres.username }}:{{ $root.Values.sharedInfra.postgres.password }}@{{ $pgHost }}:{{ $root.Values.sharedInfra.postgres.port }}/{{ $database }}"
|
|
POSTGRESQL_DATABASENAME: "{{ $database }}"
|
|
ConnectionStrings__messaging: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
|
MESSAGING_PASSWORD: "{{ $root.Values.sharedInfra.rabbitmq.password }}"
|
|
MESSAGING_URI: "amqp://{{ $root.Values.sharedInfra.rabbitmq.username }}:{{ $root.Values.sharedInfra.rabbitmq.password }}@{{ $root.Values.sharedInfra.rabbitmq.host }}:{{ $root.Values.sharedInfra.rabbitmq.port }}"
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ $name }}-web-deployment
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
|
app.kubernetes.io/component: {{ $name }}-web
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ $name }}-web
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: {{ $name }}-web
|
|
spec:
|
|
{{ include "mixingx-ultra.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
|
|
{{- with $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ $name }}-web
|
|
image: {{ $root.Values.registry }}/{{ $root.Values.images.ultraWeb.repository | default "ultra-web" }}:{{ $root.Values.images.ultraWeb.tag | default $root.Values.tag | default "latest" }}
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ $webPort }}
|
|
protocol: TCP
|
|
env:
|
|
- name: TZ
|
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
|
- name: VITE_BASE_PATH
|
|
value: "{{ $webBasePath }}"
|
|
- name: PORT
|
|
value: "{{ $webPort }}"
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $name }}-web-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ $name }}-web
|
|
mixingx.io/role: web
|
|
mixingx.io/node-id: {{ $name }}-web
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: {{ $name }}-web
|
|
ports:
|
|
- name: http
|
|
port: {{ $webPort }}
|
|
targetPort: http
|
|
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
|
|
annotations:
|
|
helm.sh/resource-policy: keep
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ include "mixingx-ultra.storageClassName" $root }}
|
|
resources:
|
|
requests:
|
|
storage: {{ $pgStorage | default "5Gi" }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: {{ $name }}-postgres
|
|
spec:
|
|
{{ include "mixingx-ultra.tierAffinity" (dict "role" $role "root" $root) | nindent 6 }}
|
|
{{- with $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: postgres
|
|
image: {{ $root.Values.sharedInfra.postgres.image | default "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 }}"
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
ports:
|
|
- name: tcp
|
|
containerPort: {{ $root.Values.sharedInfra.postgres.port }}
|
|
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: {{ $root.Values.sharedInfra.postgres.port }}
|
|
targetPort: tcp
|
|
protocol: TCP
|