Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow MQTT broker container config #506

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ To use STMP to send email
### MQTT Broker

- `forge.broker.enabled` (default `false`)
- `forge.broker.image` Allows the mosquitto broker container image to be overidden (default `iegomez/mosquitto-go-auth`)
- `forge.broker.url` URL to access the broker from inside the cluster (default `mqtt://flowforge-broker.[namespace]:1883`)
- `forge.broker.public_url` URL to access the broker from outside the cluster (default `ws://mqtt.[forge.domain]`, uses `wss://` if `forge.https` is `true`)
- `forge.broker.hostname` the custom Fully Qualified Domain Name (FQDN) where the broker will be hosted (default `mqtt.[forge.domain]`)
Expand Down
6 changes: 3 additions & 3 deletions helm/flowforge/templates/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
{{- toYaml .Values.forge.broker.podSecurityContext | nindent 8 }}
containers:
- name: broker
image: iegomez/mosquitto-go-auth
image: {{ .Values.forge.broker.image }}
imagePullPolicy: Always
volumeMounts:
- name: config
Expand Down Expand Up @@ -127,7 +127,7 @@ spec:
affinity: {{ toYaml .Values.forge.broker.affinity | nindent 8 }}
{{- end }}
{{- end }}
{{- if eq .Values.forge.broker.enabled true -}}
{{- if .Values.forge.broker.enabled }}
---
apiVersion: v1
kind: Service
Expand All @@ -148,7 +148,7 @@ spec:
selector:
{{- if and ( eq .Values.forge.broker.enabled true) ( eq .Values.forge.broker.teamBroker.enabled false ) -}}
{{- include "forge.brokerSelectorLabels" . | nindent 4 }}
{{- else -}}
{{- else }}
apps.emqx.io/db-role: core
apps.emqx.io/instance: emqx
apps.emqx.io/managed-by: emqx-operator
Expand Down
53 changes: 53 additions & 0 deletions helm/flowforge/tests/broker_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: test broker deployment
templates:
- broker.yaml
- broker-config.yaml
set:
forge.domain: "chart-unit-tests.com"
forge.broker.enabled: true
tests:
- it: should create a mosquitto broker deployment
template: broker.yaml
documentIndex: 0
asserts:
- isKind:
of: Deployment
- equal:
path: spec.template.spec.containers[?(@.name == "broker")].image
value: iegomez/mosquitto-go-auth
- lengthEqual:
path: spec.template.spec.containers
count: 1

- it: should create a broker service for mosquitto broker deployment
template: broker.yaml
documentIndex: 1
asserts:
- isKind:
of: Service
- equal:
path: spec.selector
value:
app: flowforge-broker
- not: true
equal:
path: spec.selector
value: apps.emqx.io/instance

- it: should create a broker service for emqx deployment
template: broker.yaml
documentIndex: 0
set:
forge.broker.teamBroker.enabled: true
asserts:
- isKind:
of: Service
- notExists:
path: spec.selector.app
- equal:
path: spec.selector
value:
apps.emqx.io/db-role: core
apps.emqx.io/instance: emqx
apps.emqx.io/managed-by: emqx-operator
3 changes: 3 additions & 0 deletions helm/flowforge/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@
},
"createMetricsUser": {
"type": "boolean"
},
"image": {
"type": "string"
}
},
"required": [
Expand Down
1 change: 1 addition & 0 deletions helm/flowforge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ forge:
podLabels: {}
broker:
enabled: false
image: iegomez/mosquitto-go-auth
teamBroker:
enabled: false
createMetricsUser: false
Expand Down
Loading