From 33cdd1c9d2a71da8229ebc0067739af6a8c940d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Milo=C5=A1evi=C4=87?= Date: Sat, 10 Apr 2021 22:48:34 +0200 Subject: [PATCH] MF-73 - Fix naming in MQTT statefulset (#81) * renamed mqtt statefulset file Signed-off-by: Ivan Milosevic * change naming for mqtt statefulset components Signed-off-by: Ivan Milosevic * replace hardcore value Signed-off-by: Ivan Milosevic * fix variable name Signed-off-by: Ivan Milosevic * rename mqtt-adapter to adapter-mqtt Signed-off-by: Ivan Milosevic --- charts/mainflux/README.md | 4 +- ...nt.yaml => adapter_mqtt-statefulstet.yaml} | 45 ++++++++++--------- charts/mainflux/templates/envoy.yaml | 6 +-- charts/mainflux/templates/ingress.yaml | 4 +- charts/mainflux/templates/nginx-internal.yaml | 4 +- charts/mainflux/values.yaml | 2 +- 6 files changed, 33 insertions(+), 32 deletions(-) rename charts/mainflux/templates/{adapter_mqtt-deployment.yaml => adapter_mqtt-statefulstet.yaml} (86%) diff --git a/charts/mainflux/README.md b/charts/mainflux/README.md index cd4462d1..f58370fa 100644 --- a/charts/mainflux/README.md +++ b/charts/mainflux/README.md @@ -49,8 +49,8 @@ The following table lists the configurable parameters and their default values. | things.redisESPort | Things service Redis Event Store port | 6379 | | things.redisCachePort | Things service Redis Auth Cache port | 6379 | | adapter_http.httpPort | HTTP adapter port | 8185 | -| mqtt.proxy.mqttPort | MQTT adapter proxy port | 1884 | -| mqtt.proxy.wsPort | MQTT adapter proxy WS port | 8081 | +| mqtt.adapter.mqttPort | MQTT adapter port | 1884 | +| mqtt.adapter.wsPort | MQTT adapter WS port | 8081 | | mqtt.broker.mqttPort | MQTT adapter broker port | 1883 | | mqtt.broker.wsPort | MQTT adapter broker WS port | 8080 | | mqtt.broker.persistentVolume.size | MQTT adapter broker data Persistent Volume size | 5Gi | diff --git a/charts/mainflux/templates/adapter_mqtt-deployment.yaml b/charts/mainflux/templates/adapter_mqtt-statefulstet.yaml similarity index 86% rename from charts/mainflux/templates/adapter_mqtt-deployment.yaml rename to charts/mainflux/templates/adapter_mqtt-statefulstet.yaml index 05951e9f..9f164bb5 100644 --- a/charts/mainflux/templates/adapter_mqtt-deployment.yaml +++ b/charts/mainflux/templates/adapter_mqtt-statefulstet.yaml @@ -17,45 +17,46 @@ subjects: apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }}-adapter-mqtt + name: {{ .Release.Name }}-mqtt labels: app: {{ .Release.Name }} - component: adapter-mqtt + component: mqtt spec: selector: app: {{ .Release.Name }} - component: adapter-mqtt + component: mqtt ports: - - port: {{ .Values.mqtt.proxy.mqttPort }} + - port: {{ .Values.mqtt.adapter.mqttPort }} protocol: TCP - name: "{{ .Values.mqtt.proxy.mqttPort }}" - - port: {{ .Values.mqtt.proxy.wsPort }} + name: "{{ .Values.mqtt.adapter.mqttPort }}" + - port: {{ .Values.mqtt.adapter.wsPort }} protocol: TCP - name: "{{ .Values.mqtt.proxy.wsPort }}" + name: "{{ .Values.mqtt.adapter.wsPort }}" clusterIP: None --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ .Release.Name }}-adapter-mqtt + name: {{ .Release.Name }}-mqtt spec: replicas: {{ .Values.defaults.replicaCount }} - serviceName: {{ .Release.Name }}-adapter-mqtt + serviceName: {{ .Release.Name }}-mqtt selector: matchLabels: app: {{ .Release.Name }} - component: adapter-mqtt + component: mqtt template: metadata: labels: app: {{ .Release.Name}} - component: adapter-mqtt + component: mqtt spec: dnsPolicy: ClusterFirst restartPolicy: Always securityContext: {{ toYaml .Values.mqtt.securityContext | nindent 8 }} containers: + #broker - volumeMounts: - name: data mountPath: /vernemq/data @@ -79,7 +80,7 @@ spec: - name: DOCKER_VERNEMQ_DISCOVERY_KUBERNETES value: "1" - name: DOCKER_VERNEMQ_KUBERNETES_LABEL_SELECTOR - value: "app={{ .Release.Name }},component=adapter-mqtt" + value: "app={{ .Release.Name }},component=mqtt" - name: DOCKER_VERNEMQ_ALLOW_REGISTER_DURING_NETSPLIT value: "on" - name: DOCKER_VERNEMQ_MAX_OFFLINE_MESSAGES @@ -98,7 +99,7 @@ spec: value: "127.0.0.1:8080" image: "{{ default .Values.defaults.image.repository .Values.mqtt.broker.image.repository }}:{{ default .Values.defaults.image.tag .Values.mqtt.broker.image.tag }}" imagePullPolicy: {{ default .Values.defaults.image.pullPolicy .Values.mqtt.broker.image.pullPolicy }} - name: {{ .Release.Name }}-adapter-mqtt + name: {{ .Release.Name }}-broker-mqtt ports: - containerPort: 1883 protocol: TCP @@ -154,24 +155,24 @@ spec: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 - #mproxy - - name: {{ .Release.Name }}-mqtt-proxy - image: "{{ default .Values.defaults.image.repository .Values.mqtt.proxy.image.repository }}:{{ default .Values.defaults.image.tag .Values.mqtt.proxy.image.tag }}" - imagePullPolicy: {{ default .Values.defaults.image.pullPolicy .Values.mqtt.proxy.image.imagePullPolicy}} + #adapter + - name: {{ .Release.Name }}-adapter-mqtt + image: "{{ default .Values.defaults.image.repository .Values.mqtt.adapter.image.repository }}:{{ default .Values.defaults.image.tag .Values.mqtt.adapter.image.tag }}" + imagePullPolicy: {{ default .Values.defaults.image.pullPolicy .Values.mqtt.adapter.image.imagePullPolicy}} ports: - - containerPort: {{ .Values.mqtt.proxy.mqttPort }} + - containerPort: {{ .Values.mqtt.adapter.mqttPort }} protocol: TCP - - containerPort: {{ .Values.mqtt.proxy.wsPort }} + - containerPort: {{ .Values.mqtt.adapter.wsPort }} protocol: TCP stdin: true tty: true env: - name: MF_MQTT_ADAPTER_LOG_LEVEL - value: {{ default .Values.defaults.logLevel .Values.mqtt.proxy.logLevel }} + value: {{ default .Values.defaults.logLevel .Values.mqtt.adapter.logLevel }} - name: MF_MQTT_ADAPTER_MQTT_PORT - value: "{{ .Values.mqtt.proxy.mqttPort }}" + value: "{{ .Values.mqtt.adapter.mqttPort }}" - name: MF_MQTT_ADAPTER_WS_PORT - value: "{{ .Values.mqtt.proxy.wsPort }}" + value: "{{ .Values.mqtt.adapter.wsPort }}" - name: MF_MQTT_ADAPTER_ES_URL value: {{ .Release.Name }}-redis-streams-master:{{ .Values.mqtt.redisESPort }} - name: MF_NATS_URL diff --git a/charts/mainflux/templates/envoy.yaml b/charts/mainflux/templates/envoy.yaml index 7bd72482..83f8683f 100644 --- a/charts/mainflux/templates/envoy.yaml +++ b/charts/mainflux/templates/envoy.yaml @@ -14,7 +14,7 @@ data: - filters: - name: envoy.tcp_proxy config: - stat_prefix: adapter-mqtt + stat_prefix: mqtt cluster: adapter-mqtt - address: socket_address: @@ -59,13 +59,13 @@ data: - name: envoy.grpc_web - name: envoy.router clusters: - - name: adapter-mqtt + - name: mqtt connect_timeout: 0.25s type: strict_dns lb_policy: round_robin hosts: - socket_address: - address: {{ .Release.Name }}-adapter-mqtt + address: {{ .Release.Name }}-mqtt port_value: 1884 - name: auth connect_timeout: 0.25s diff --git a/charts/mainflux/templates/ingress.yaml b/charts/mainflux/templates/ingress.yaml index 8b695c9f..78a25d06 100644 --- a/charts/mainflux/templates/ingress.yaml +++ b/charts/mainflux/templates/ingress.yaml @@ -176,8 +176,8 @@ spec: servicePort: {{ .Values.adapter_http.httpPort }} - path: /(mqtt) backend: - serviceName: {{ .Release.Name }}-adapter-mqtt - servicePort: {{ default .Values.mqtt.proxy.wsPort }} + serviceName: {{ .Release.Name }}-mqtt + servicePort: {{ default .Values.mqtt.adapter.wsPort }} {{- end }} {{- if .Values.ingress.tls }} tls: diff --git a/charts/mainflux/templates/nginx-internal.yaml b/charts/mainflux/templates/nginx-internal.yaml index 4d71f19a..93625e42 100644 --- a/charts/mainflux/templates/nginx-internal.yaml +++ b/charts/mainflux/templates/nginx-internal.yaml @@ -147,7 +147,7 @@ data: } } - #Proxy pass to mainflux-mqtt-adapter for MQTT over WS + #Proxy pass to mainflux-mqtt for MQTT over WS location /mqtt { if ($auth_key = '') { return 403; @@ -163,7 +163,7 @@ data: proxy_connect_timeout 7d; proxy_send_timeout 7d; proxy_read_timeout 7d; - proxy_pass http://{{ .Release.Name }}-adapter-mqtt:8081; + proxy_pass http://{{ .Release.Name }}-mqtt:{{ .Values.mqtt.adapter.wsPort }}; # Allow OPTIONS method CORS if ($request_method = OPTIONS ) { diff --git a/charts/mainflux/values.yaml b/charts/mainflux/values.yaml index a02a42d6..1249d76d 100644 --- a/charts/mainflux/values.yaml +++ b/charts/mainflux/values.yaml @@ -76,7 +76,7 @@ mqtt: runAsUser: 10000 runAsGroup: 10000 fsGroup: 10000 - proxy: + adapter: image: repository: "mainflux/mqtt" mqttPort: 1884