- 添加global.imageRegistry作为统一镜像仓库地址配置项 - 创建通用image模板函数处理镜像地址拼接逻辑 - 更新所有chart使用新的镜像配置结构 - 在README中添加镜像地址约定说明 - 修改CI命令示例以包含必要的镜像配置参数 - 将硬编码的镜像地址改为通过values动态配置
68 lines
2.2 KiB
YAML
68 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 }}
|
||
containers:
|
||
- name: nanomq
|
||
image: {{ include "mixingx-edge-unit.image" (dict "registry" .Values.global.imageRegistry "image" .Values.images.nanomq) | quote }}
|
||
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 }}
|