- 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 为当前缺口)
72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
{{- $name := include "mixingx-unit.name" . -}}
|
||
{{- $brokerName := include "mixingx-unit.mqttBrokerName" . -}}
|
||
{{- $brokerSvcName := include "mixingx-unit.mqttBrokerServiceName" . -}}
|
||
{{- $credentialRef := include "mixingx-unit.mqttCredentialRef" . -}}
|
||
{{- if .Values.mqtt.enabled }}
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: {{ $brokerName }}
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||
app.kubernetes.io/component: {{ $brokerName }}
|
||
spec:
|
||
replicas: 1
|
||
selector:
|
||
matchLabels:
|
||
app.kubernetes.io/component: {{ $brokerName }}
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app.kubernetes.io/component: {{ $brokerName }}
|
||
spec:
|
||
{{ include "mixingx-unit.backendScheduling" . | nindent 6 }}
|
||
{{- with $.Values.imagePullSecrets }}
|
||
imagePullSecrets:
|
||
{{- toYaml . | nindent 8 }}
|
||
{{- end }}
|
||
containers:
|
||
- name: nanomq
|
||
image: "{{ .Values.mqtt.image.repository }}:{{ .Values.mqtt.image.tag }}"
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- name: mqtt
|
||
containerPort: {{ .Values.mqtt.port }}
|
||
protocol: TCP
|
||
# WebSocket listener:emqx/nanomq 镜像默认开启 8083(路径 /mqtt)。
|
||
# 声明此 containerPort 供 MQTTX Web 等浏览器客户端通过 ws 连接。
|
||
# Service 默认 ClusterIP,运维需外部调试时手动改 NodePort。
|
||
- name: ws
|
||
containerPort: {{ .Values.mqtt.wsPort | default 8083 }}
|
||
protocol: TCP
|
||
resources:
|
||
{{ toYaml .Values.mqtt.resources | default dict | nindent 12 }}
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: {{ $brokerSvcName }}
|
||
labels:
|
||
app.kubernetes.io/name: mixingx
|
||
app.kubernetes.io/component: {{ $brokerName }}
|
||
mixingx.io/role: mqtt-broker
|
||
mixingx.io/node-id: {{ $name }}
|
||
annotations:
|
||
mixingx.io/credential-ref: {{ $credentialRef }}
|
||
spec:
|
||
type: ClusterIP
|
||
selector:
|
||
app.kubernetes.io/component: {{ $brokerName }}
|
||
ports:
|
||
- name: mqtt
|
||
port: {{ .Values.mqtt.port }}
|
||
targetPort: mqtt
|
||
protocol: TCP
|
||
- name: ws
|
||
port: {{ .Values.mqtt.wsPort | default 8083 }}
|
||
targetPort: ws
|
||
protocol: TCP
|
||
{{- end }}
|