Skip to content

Commit

Permalink
MF-73 - Fix naming in MQTT statefulset (#81)
Browse files Browse the repository at this point in the history
* renamed mqtt statefulset file

Signed-off-by: Ivan Milosevic <[email protected]>

* change naming for mqtt statefulset components

Signed-off-by: Ivan Milosevic <[email protected]>

* replace hardcore value

Signed-off-by: Ivan Milosevic <[email protected]>

* fix variable name

Signed-off-by: Ivan Milosevic <[email protected]>

* rename mqtt-adapter to adapter-mqtt

Signed-off-by: Ivan Milosevic <[email protected]>
  • Loading branch information
blokovi authored Apr 10, 2021
1 parent d104dff commit 33cdd1c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions charts/mainflux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions charts/mainflux/templates/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data:
- filters:
- name: envoy.tcp_proxy
config:
stat_prefix: adapter-mqtt
stat_prefix: mqtt
cluster: adapter-mqtt
- address:
socket_address:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions charts/mainflux/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions charts/mainflux/templates/nginx-internal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion charts/mainflux/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mqtt:
runAsUser: 10000
runAsGroup: 10000
fsGroup: 10000
proxy:
adapter:
image:
repository: "mainflux/mqtt"
mqttPort: 1884
Expand Down

0 comments on commit 33cdd1c

Please sign in to comment.