feat: Add broadlinkac2mqtt Helm chart with configuration and templates

This commit is contained in:
sha
2026-05-24 01:41:23 +03:00
parent bf4326b6da
commit 595f1057a0
8 changed files with 505 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
data:
config.yml: |
service:
update_interval: {{ .Values.config.service.update_interval }}
log_level: {{ .Values.config.service.log_level }}
mqtt:
server: {{ .Values.config.mqtt.server | quote }}
{{- if .Values.existingSecret }}
user: ${MQTT_USER}
password: ${MQTT_PASSWORD}
{{- else }}
user: {{ .Values.config.mqtt.user | quote }}
password: {{ .Values.config.mqtt.password | quote }}
{{- end }}
client_id: {{ .Values.config.mqtt.client_id | quote }}
discovery: {{ .Values.config.mqtt.discovery }}
discovery_prefix: {{ .Values.config.mqtt.discovery_prefix | quote }}
topic_prefix: {{ .Values.config.mqtt.topic_prefix | quote }}
state_topic: {{ .Values.config.mqtt.state_topic | quote }}
command_topic: {{ .Values.config.mqtt.command_topic | quote }}
availability_topic: {{ .Values.config.mqtt.availability_topic | quote }}
{{- with .Values.config.mqtt.ca_cert }}
ca_cert: {{ . | quote }}
{{- end }}
{{- with .Values.config.mqtt.client_cert }}
client_cert: {{ . | quote }}
{{- end }}
{{- with .Values.config.mqtt.client_key }}
client_key: {{ . | quote }}
{{- end }}
devices:
{{- range .Values.config.devices }}
- ip: {{ .ip | quote }}
mac: {{ .mac | quote }}
name: {{ .name | quote }}
{{- with .port }}
port: {{ . }}
{{- end }}
{{- with .temp_unit }}
temp_unit: {{ . | quote }}
{{- end }}
{{- end }}
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/component: mqtt-bridge
app.kubernetes.io/part-of: home-automation
annotations:
version-source: {{ index .Chart.Annotations "version-source" }}
version-pattern: {{ index .Chart.Annotations "version-pattern" | quote }}
spec:
replicas: 1
strategy:
type: Recreate # Only one instance should control the AC units
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: {{ .Values.timezone | quote }}
{{- if .Values.existingSecret }}
- name: MQTT_USER
valueFrom:
secretKeyRef:
name: {{ .Values.existingSecret }}
key: {{ .Values.secretKeys.mqttUser }}
- name: MQTT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.existingSecret }}
key: {{ .Values.secretKeys.mqttPassword }}
{{- end }}
volumeMounts:
- name: config
mountPath: /app/config
readOnly: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
# Startup probe: give MQTT connection and device auth time to complete
startupProbe:
exec:
command:
- /bin/sh
- -c
- 'pgrep -f /main > /dev/null'
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 12 # 60 seconds total startup time
# Liveness probe: verify process is still running
livenessProbe:
exec:
command:
- /bin/sh
- -c
- 'pgrep -f /main > /dev/null'
initialDelaySeconds: 30
periodSeconds: 30
failureThreshold: 3
# Readiness probe: check config file is present and process is running
readinessProbe:
exec:
command:
- /bin/sh
- -c
- 'test -f /app/config/config.yml && pgrep -f /main > /dev/null'
initialDelaySeconds: 10
periodSeconds: 15
volumes:
- name: config
configMap:
name: {{ .Release.Name }}-config
+30
View File
@@ -0,0 +1,30 @@
# Ingress is not applicable for broadlinkac2mqtt (MQTT-only application)
# This template is included for Helm chart consistency only
{{- range $name, $ingress := .Values.ingresses }}
# ---
# apiVersion: traefik.io/v1alpha1
# kind: IngressRoute
# metadata:
# name: {{ $.Release.Name }}-{{ $name }}
# labels:
# app.kubernetes.io/name: {{ $.Chart.Name }}
# app.kubernetes.io/instance: {{ $.Release.Name }}
# {{- with $ingress.annotations }}
# annotations:
# {{- toYaml . | nindent 4 }}
# {{- end }}
# spec:
# entryPoints:
# - websecure
# routes:
# - kind: Rule
# match: Host(`{{ $ingress.host }}`)
# services:
# - name: {{ $.Release.Name }}
# port: 80
# {{- with $ingress.tls }}
# tls:
# {{- toYaml . | nindent 4 }}
# {{- end }}
{{- end }}
+17
View File
@@ -0,0 +1,17 @@
# This service is not used by broadlinkac2mqtt (MQTT-only application)
# Included for Helm chart consistency only
# apiVersion: v1
# kind: Service
# metadata:
# name: {{ .Release.Name }}
# labels:
# app.kubernetes.io/name: {{ .Chart.Name }}
# app.kubernetes.io/instance: {{ .Release.Name }}
# spec:
# type: ClusterIP
# selector:
# app: {{ .Release.Name }}
# ports:
# - protocol: TCP
# port: 80
# targetPort: 80