Skip to content
Open
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
6 changes: 4 additions & 2 deletions tbmq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 2.1.0
description: Helm chart for TBMQ cluster.
name: tbmq-cluster
type: application
version: 1.0.0
version: 1.1.0
annotations:
artifacthub.io/category: streaming-messaging
licenses: Apache-2.0
Expand All @@ -15,7 +15,7 @@ annotations:
artifacthub.io/prerelease: "false"
artifacthub.io/changes: |
- kind: added
description: Release 1.0.0
description: Release 1.1.0
links:
- name: GitHub PR
url: https://github.com/thingsboard/helm-charts/pull/9
Expand All @@ -34,10 +34,12 @@ dependencies:
- name: redis-cluster
version: 10.3.0
repository: oci://registry-1.docker.io/bitnamicharts
condition: redis-cluster.enabled
- name: postgresql
version: 15.5.38
repository: oci://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled
- name: kafka
version: 29.3.4
repository: oci://registry-1.docker.io/bitnamicharts
condition: kafka.enabled
57 changes: 43 additions & 14 deletions tbmq/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@
{{/*Return redis cluster configurations environment variables for tbmq services*/}}
{{- define "tbmq.redis.configuration.ref"}}
- configMapRef:
name: {{ .Release.Name }}-redis-config
{{- end}}
name: {{ .Values.externalRedis.existingConfigMap | default (printf "%s-redis-config" .Release.Name) }}
{{- end }}

{{/*Returns redis cluster secret name*/}}
{{- define "tbmq.redis.secretName" -}}
{{- $redis := index .Values "redis-cluster" }}
{{- if not $redis.enabled -}}
{{- .Values.externalRedis.existingSecret -}}
{{- else -}}
{{- if $redis.existingSecret }}
{{- $redis.existingSecret }}
{{- else if $redis.fullnameOverride }}
Expand All @@ -92,18 +95,19 @@
{{- printf "%s-redis-cluster" .Release.Name }}
{{- end }}
{{- end }}
{{- end }}

{{/*Returns redis cluster secret key*/}}
{{- define "tbmq.redis.secretKey" -}}
{{- $redis := index .Values "redis-cluster" }}
{{- if $redis.existingSecret -}}
{{- if not $redis.enabled }}
{{- .Values.externalRedis.existingSecretKey -}}
{{- else if $redis.existingSecret}}
{{ $redis.existingSecretPasswordKey | default "REDIS_PASSWORD" }}
{{- else -}}
redis-password
{{- end -}}
{{- end }}


{{- end }}

{{/*Return redis cluster nodes*/}}
{{- define "tbmq.redis.nodes" -}}
Expand All @@ -119,13 +123,17 @@ redis-password
{{/*Return postgresql configurations environment variables for tbmq services*/}}
{{- define "tbmq.postgres.configuration.ref"}}
- configMapRef:
name: {{ .Release.Name }}-postgres-config
{{- end}}
name: {{ .Values.externalPostgresql.existingConfigMap | default (printf "%s-postgres-config" .Release.Name) }}
{{- end }}

{{/*Return postgresql secret name*/}}
{{- define "tbmq.postgres.secretName" -}}
{{- if not .Values.postgresql.enabled }}
{{- if .Values.externalPostgresql.existingSecret }}
{{- .Values.externalPostgresql.existingSecret }}
{{- else -}}
{{- printf "%s-postgres-external" .Release.Name }}
{{- end }}
{{- else if .Values.postgresql.auth.existingSecret }}
{{- .Values.postgresql.auth.existingSecret }}
{{- else if .Values.postgresql.fullnameOverride }}
Expand All @@ -137,10 +145,15 @@ redis-password
{{- end }}
{{- end }}


{{/*Return postgresql secret key*/}}
{{- define "tbmq.postgres.secretKey" -}}
{{- define "tbmq.postgres.secretPasswordKey" -}}
{{- if not .Values.postgresql.enabled -}}
{{- if .Values.externalPostgresql.existingSecretPasswordKey -}}
{{- .Values.externalPostgresql.existingSecretPasswordKey -}}
{{- else -}}
external-postgres-password
{{- end }}
{{- else if .Values.postgresql.auth.existingSecret }}
{{- if and .Values.postgresql.auth.enablePostgresUser (not .Values.postgresql.auth.username) -}}
{{- .Values.postgresql.auth.secretKeys.adminPasswordKey }}
Expand All @@ -156,6 +169,17 @@ external-postgres-password
{{- end -}}
{{- end }}

{{/*Return postgresql secret key*/}}
{{- define "tbmq.postgres.secretUsernameKey" -}}
{{- if not .Values.postgresql.enabled -}}
{{- if .Values.externalPostgresql.existingSecretUsernameKey -}}
{{- .Values.externalPostgresql.existingSecretUsernameKey -}}
{{- else -}}
external-postgres-username
{{- end }}
{{- end }}
{{- end }}

{{/*Return postgres host*/}}
{{- define "tbmq.postgres.host" -}}
{{- if .Values.postgresql.enabled -}}
Expand Down Expand Up @@ -204,8 +228,8 @@ external-postgres-password
{{/*Return kafka configurations environment variables for tbmq services*/}}
{{- define "tbmq.kafka.configuration.ref"}}
- configMapRef:
name: {{ .Release.Name }}-kafka-config
{{- end}}
name: {{ .Values.externalKafka.existingConfigMap | default (printf "%s-kafka-config" .Release.Name) }}
{{- end }}

{{/*Return kafka servers environment variables for tbmq services*/}}
{{- define "tbmq.kafka.servers" -}}
Expand Down Expand Up @@ -238,15 +262,20 @@ external-postgres-password
value: {{ include "tbmq.postgres.host" . | quote }}
- name: PGDATABASE
value: {{ include "tbmq.postgres.database" . | quote }}
- name: PGUSER
value: {{ include "tbmq.postgres.username" . | quote }}
- name: QUERY_TO_VALIDATE_DATA
value: {{ $query | quote }}
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretKey" . }}
key: {{ include "tbmq.postgres.secretPasswordKey" . }}
{{- if .Values.externalPostgresql.existingSecretUsernameKey }}
- name: PGUSER
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretUsernameKey" . }}
{{- end }}
command:
- bash
args:
Expand Down
11 changes: 9 additions & 2 deletions tbmq/templates/install/post-install-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretKey" . }}
{{- if index .Values "redis-cluster" "usePassword" }}
key: {{ include "tbmq.postgres.secretPasswordKey" . }}
{{- if .Values.externalPostgresql.existingSecretUsernameKey }}
- name: SPRING_DATASOURCE_USER
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretUsernameKey" . }}
{{- end }}
{{- if or (index .Values "redis-cluster" "usePassword") .Values.externalRedis.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
2 changes: 2 additions & 0 deletions tbmq/templates/kafka/kafka-configmap.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if and (empty .Values.kafka.existingConfigMap) .Values.kafka.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- $releaseName := .Release.Name }}
apiVersion: v1
Expand Down Expand Up @@ -39,3 +40,4 @@ data:
TB_KAFKA_DEFAULT_PRODUCER_BUFFER_MEMORY: "33554432"
# The compression type for all data generated by the producer. Valid values are `none`, `gzip`, `snappy`, `lz4`, or `zstd`
TB_KAFKA_DEFAULT_COMPRESSION_TYPE: "none"
{{- end -}}
19 changes: 16 additions & 3 deletions tbmq/templates/loadbalancer/default/http-load-balancer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ kind: Ingress
metadata:
name: {{ .Release.Name }}-http-lb
namespace: {{ .Release.Namespace }}
{{- with .Values.loadbalancer.http.annotations }}
annotations:
{{ toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: nginx
rules:
- http:
ingressClassName: {{ .Values.loadbalancer.http.ingressClassName | default "nginx" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t see loadbalancer.http.ingressClassName in values.yaml, but the template reads it. Could you share why we need to make the class name configurable here?

Today we hardcode the class per provider (nginx → nginx, Azure → azure/application-gateway, GCP → gce, AWS → ALB via annotations). This keeps provider files simple and avoids an extra, undocumented knob.

If the goal is to support a different Ingress controller/class (e.g., a custom NGINX class, Traefik, or another AGIC class), can you add a brief use case? With that context we can either:

  • Add a new provider type
  • or, allow class override for specific providers

Happy to go with whatever best matches your use case — just want to keep the chart predictable and well-documented.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason is that you can have many ingress controllers in the kubernetes cluster, for instance we have one for the management and one for external exposure. ingress ClassName is different if you have separate controllers. Most of times today, this is the reality and most production clusters are like that.

rules:
- host: {{ .Values.loadbalancer.http.host | default "\"\"" }}
Comment thread
Cyanopus marked this conversation as resolved.
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for host contains escaped quotes that will result in literal quote characters in the YAML output. Use "" instead of "\"\"" or remove the default entirely since an empty host is valid.

Suggested change
- host: {{ .Values.loadbalancer.http.host | default "\"\"" }}
- host: {{ .Values.loadbalancer.http.host | default """" }}

Copilot uses AI. Check for mistakes.
http:
paths:
- path: /
pathType: Prefix
Expand All @@ -16,4 +21,12 @@ spec:
name: {{ include "tbmq.node.label" . }}
port:
name: http
{{- if .Values.loadbalancer.http.ssl.enabled }}
tls:
- hosts:
{{- range .Values.loadbalancer.http.ssl.hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .Values.loadbalancer.http.ssl.secretName }}
{{- end }}
Comment on lines +24 to +31
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the contribution and for aiming to add SSL/TLS support for HTTP ingress with host and certificate configuration. We really appreciate it.

We have already merged a number of related changes internally (external Redis, external Kafka, LB annotations with user-wins merge, provider-specific ingress updates), so parts of this PR now overlap. To keep history clean and the scope clear, could you please resubmit a focused PR just for the HTTP TLS feature?

{{- end }}
11 changes: 9 additions & 2 deletions tbmq/templates/loadbalancer/default/mqtt-load-balancer.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{{- if and (eq .Values.loadbalancer.type "nginx") .Values.loadbalancer.mqtt.enabled }}
{{- if and (eq .Values.loadbalancer.type "nginx") .Values.loadbalancer.mqtt.enabled -}}
{{- $serviceType := .Values.loadbalancer.mqtt.type | default "LoadBalancer" }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-mqtt-lb
namespace: {{ .Release.Namespace }}
{{- with .Values.loadbalancer.mqtt.annotations }}
annotations:
{{ toYaml . | nindent 4 }}
{{- end }}
Comment on lines +8 to +11
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t see loadbalancer.mqtt.annotations in values.yaml, but the MQTT LB template reads it. Please add the param to values.yaml so users can discover and set it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add.

spec:
type: LoadBalancer
type: {{ $serviceType }}
{{- if or (eq $serviceType "NodePort") (eq $serviceType "LoadBalancer") }}
externalTrafficPolicy: Local
{{- end }}
selector:
app: {{ include "tbmq.node.label" . }}
ports:
Expand Down
2 changes: 2 additions & 0 deletions tbmq/templates/postgres/postgres-configmap.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if and (empty .Values.postgresql.existingConfigMap) .Values.postgresql.enabled }}
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks .Values.postgresql.enabled but according to the values.yaml diff, PostgreSQL doesn't have an enabled field added like Redis and Kafka do. This will likely cause the template to fail when postgresql.enabled is undefined.

Suggested change
{{- if and (empty .Values.postgresql.existingConfigMap) .Values.postgresql.enabled }}
{{- if and (empty .Values.postgresql.existingConfigMap) (default true .Values.postgresql.enabled) }}

Copilot uses AI. Check for mistakes.
{{- $namespace := .Release.Namespace -}}
{{- $releaseName := .Release.Name }}
apiVersion: v1
Expand All @@ -20,3 +21,4 @@ data:
SPRING_DATASOURCE_MAXIMUM_POOL_SIZE: "16"
# This property controls the max lifetime in milliseconds of a connection. Only when it is closed will it then be removed. Default is 10 minutes
SPRING_DATASOURCE_MAX_LIFETIME: "600000"
{{- end -}}
2 changes: 1 addition & 1 deletion tbmq/templates/postgres/postgres-secret.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.postgresql.enabled }}
{{- if and (not .Values.postgresql.enabled) (not .Values.externalPostgresql.existingSecret) }}
{{- $namespace := .Release.Namespace -}}
{{- $releaseName := .Release.Name }}
apiVersion: v1
Expand Down
2 changes: 2 additions & 0 deletions tbmq/templates/redis/redis-configmap.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if and (empty (index .Values "redis-cluster" "existingConfigMap")) (index .Values "redis-cluster" "enabled") }}
{{- $namespace := .Release.Namespace -}}
{{- $releaseName := .Release.Name }}
{{- $redisName := index .Values "redis-cluster" "nameOverride" }}
Expand Down Expand Up @@ -53,3 +54,4 @@ data:
REDIS_JEDIS_CLUSTER_TOPOLOGY_REFRESH_ENABLED: "true"
# Specifies the interval (in seconds) for periodic cluster topology updates
REDIS_JEDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC: "60"
{{- end -}}
13 changes: 10 additions & 3 deletions tbmq/templates/tbmq/tbmq-statefulset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretKey" . }}
{{- if index .Values "redis-cluster" "usePassword" }}
key: {{ include "tbmq.postgres.secretPasswordKey" . }}
{{- if .Values.externalPostgresql.existingSecretUsernameKey }}
- name: SPRING_DATASOURCE_USER
valueFrom:
secretKeyRef:
name: {{ include "tbmq.postgres.secretName" . }}
key: {{ include "tbmq.postgres.secretUsernameKey" . }}
{{- end }}
{{- if or (index .Values "redis-cluster" "usePassword") .Values.externalRedis.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -144,4 +151,4 @@ spec:
- name: {{ $releaseName }}-tbmq-node-logs
emptyDir: { }
- name: {{ printf "%s-tbmq-node-data" $releaseName }}
emptyDir: { }
emptyDir: { }
Loading