- 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 为当前缺口)
121 lines
3.5 KiB
YAML
121 lines
3.5 KiB
YAML
{{- range .Values.sharedDatastores }}
|
|
{{- $root := $ }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ .name }}-statefulset
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
serviceName: {{ .name }}-service
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
annotations:
|
|
helm.sh/resource-policy: keep
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ include "mixingx-platform.storageClassName" $root }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .storage }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
{{ include "mixingx-platform.tierAffinity" (dict "role" "sharedDatastores" "root" $root) | nindent 6 }}
|
|
{{- with $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .name }}
|
|
image: {{ .image }}
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: tcp
|
|
containerPort: {{ .port }}
|
|
protocol: TCP
|
|
{{- if eq .name "redis" }}
|
|
command: ["/bin/sh"]
|
|
args:
|
|
- "-c"
|
|
- "redis-server --requirepass {{ $root.Values.sharedInfra.redis.password }} --save 60 1"
|
|
{{- end }}
|
|
{{- if eq .name "mongo" }}
|
|
env:
|
|
- name: MONGO_INITDB_ROOT_USERNAME
|
|
value: "{{ $root.Values.sharedInfra.mongo.username }}"
|
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
value: "{{ $root.Values.sharedInfra.mongo.password }}"
|
|
{{- end }}
|
|
{{- if eq .name "messaging" }}
|
|
env:
|
|
- name: RABBITMQ_DEFAULT_USER
|
|
value: "{{ $root.Values.sharedInfra.rabbitmq.username }}"
|
|
- name: RABBITMQ_DEFAULT_PASS
|
|
value: "{{ $root.Values.sharedInfra.rabbitmq.password }}"
|
|
{{- end }}
|
|
{{- if eq .name "audit-nanomq" }}
|
|
command: ["/bin/sh"]
|
|
args:
|
|
- "-c"
|
|
- |
|
|
cat > /etc/nanomq.conf <<EOF
|
|
mqtt {
|
|
allow_anonymous = true
|
|
max_mqueue_len = 128
|
|
}
|
|
http_server {
|
|
enable = true
|
|
port = 8081
|
|
username = {{ $root.Values.audit.mqtt.managementUsername }}
|
|
password = {{ $root.Values.audit.mqtt.managementPassword }}
|
|
}
|
|
EOF
|
|
exec nanomq start --conf /etc/nanomq.conf
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: {{ .mountPath }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ .name }}-service
|
|
labels:
|
|
app.kubernetes.io/name: mixingx
|
|
app.kubernetes.io/component: {{ .name }}
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/component: {{ .name }}
|
|
ports:
|
|
- name: tcp
|
|
port: {{ .port }}
|
|
targetPort: tcp
|
|
protocol: TCP
|
|
{{- if eq .name "messaging" }}
|
|
- name: management
|
|
port: 15672
|
|
targetPort: 15672
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- if eq .name "audit-nanomq" }}
|
|
- name: mqtt
|
|
port: {{ $root.Values.audit.mqtt.brokerPort }}
|
|
targetPort: {{ $root.Values.audit.mqtt.brokerPort }}
|
|
protocol: TCP
|
|
- name: management
|
|
port: {{ $root.Values.audit.mqtt.managementPort }}
|
|
targetPort: {{ $root.Values.audit.mqtt.managementPort }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- end }}
|