mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 15:39:02 +00:00
[zigbee2mqtt] ui application (#296)
* Including UI with lint Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Ingress deactivated by default Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Version 0.2.0 Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Add ui settings Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Display the application URL Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Protect boolean as string Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Remove warning from lint Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Move probes, service and ingress within ui values Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Revert "Move probes, service and ingress within ui values" This reverts commit 08a91e316bb81aee43739ed51f89d378541cf255. * Using generic configmap por assistant settings Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Move probes, services and ingress within assistant section Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> * Some wording Signed-off-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com> Co-authored-by: Miguel Angel Santiago <miguelangel.santiago@hotmail.com>
This commit is contained in:
parent
40b25ebdcd
commit
d733be90e3
@ -3,7 +3,7 @@ name: zigbee2mqtt
|
||||
type: application
|
||||
description: Bridges events and allows you to control your Zigbee devices via MQTT
|
||||
appVersion: 1.14.1
|
||||
version: 0.1.0
|
||||
version: 0.2.0
|
||||
keywords:
|
||||
- zigbee
|
||||
- mqtt
|
||||
@ -14,3 +14,5 @@ sources:
|
||||
maintainers:
|
||||
- name: ishioni
|
||||
email: helm@movishell.pl
|
||||
- name: masantiago
|
||||
email: miguelangel.santiago@hotmail.com
|
||||
|
@ -7,3 +7,24 @@ WARNING: You have not set a network key, which makes zigbee2mqtt run with a well
|
||||
Please read https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.assistant.enabled }}
|
||||
Get the Z2MA URL by running these commands:
|
||||
{{- if .Values.assistant.ingress.enabled }}
|
||||
{{- range .Values.assistant.ingress.hosts }}
|
||||
http{{ if $.Values.assistant.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.assistant.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.assistant.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "zigbee2mqtt.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.assistant.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ include "zigbee2mqtt.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "zigbee2mqtt.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.assistant.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.assistant.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "zigbee2mqtt.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:5000 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 5000:80
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@ -9,3 +9,40 @@ data:
|
||||
{{- with .Values.config }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.assistant.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}assistant
|
||||
labels:
|
||||
{{ include "zigbee2mqtt.labels" . | indent 4 }}
|
||||
data:
|
||||
TZ: {{ .Values.timezone | quote }}
|
||||
{{- $server := default "mqtt://localhost:1883" .Values.config.mqtt.server }}
|
||||
{{- $protocol := (split "://" $server)._0 }}
|
||||
{{- $host := (split ":" (split "://" $server)._1)._0 }}
|
||||
{{- $port := (split ":" $server)._2 }}
|
||||
Z2MA_SETTINGS__MQTTSERVER: {{ $host }}
|
||||
{{- if eq $protocol "mqtts"}}
|
||||
Z2MA_SETTINGS__MQTTSECURE: "true"
|
||||
{{- end }}
|
||||
{{- if $port }}
|
||||
Z2MA_SETTINGS__MQTTPORT: {{ $port }}
|
||||
{{- end }}
|
||||
{{- if .Values.config.mqtt.user }}
|
||||
Z2MA_SETTINGS__MQTTUSERNAME: {{ .Values.config.mqtt.user }}
|
||||
{{- end }}
|
||||
{{- if .Values.config.mqtt.password }}
|
||||
Z2MA_SETTINGS__MQTTPASSWORD: {{ .Values.config.mqtt.password }}
|
||||
{{- end }}
|
||||
{{- if .Values.config.mqtt.base_topic }}
|
||||
Z2MA_SETTINGS__BASETOPIC: {{ .Values.config.mqtt.base_topic }}
|
||||
{{- end }}
|
||||
{{- if and .Values.config.homeassistant .Values.config.advanced.homeassistant_discovery_topic }}
|
||||
Z2MA_SETTINGS__HOMEASSISTANTDISCOVERYBASETOPIC: {{ .Values.config.advanced.homeassistant_discovery_topic }}
|
||||
{{- end }}
|
||||
{{- range $key, $val := .Values.assistant.config }}
|
||||
Z2MA_SETTINGS__{{ $key | upper }}: {{ $val | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
35
charts/zigbee2mqtt/templates/ingress.yaml
Normal file
35
charts/zigbee2mqtt/templates/ingress.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
{{- if and .Values.assistant.enabled .Values.assistant.ingress.enabled -}}
|
||||
{{- $fullName := include "zigbee2mqtt.fullname" . -}}
|
||||
{{- $ingressPath := .Values.assistant.ingress.path -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{ include "zigbee2mqtt.labels" . | indent 4 }}
|
||||
{{- with .Values.assistant.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.assistant.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.assistant.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.assistant.ingress.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: http
|
||||
{{- end }}
|
||||
{{- end }}
|
50
charts/zigbee2mqtt/templates/service.yaml
Normal file
50
charts/zigbee2mqtt/templates/service.yaml
Normal file
@ -0,0 +1,50 @@
|
||||
{{- if .Values.assistant.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "zigbee2mqtt.fullname" . }}
|
||||
labels:
|
||||
{{ include "zigbee2mqtt.labels" . | indent 4 }}
|
||||
{{- if .Values.assistant.service.labels }}
|
||||
{{ toYaml .Values.assistant.service.labels | indent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.assistant.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if (or (eq .Values.assistant.service.type "ClusterIP") (empty .Values.assistant.service.type)) }}
|
||||
type: ClusterIP
|
||||
{{- if .Values.assistant.service.clusterIP }}
|
||||
clusterIP: {{ .Values.assistant.service.clusterIP }}
|
||||
{{end}}
|
||||
{{- else if eq .Values.assistant.service.type "LoadBalancer" }}
|
||||
type: {{ .Values.assistant.service.type }}
|
||||
{{- if .Values.assistant.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.assistant.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.assistant.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml .Values.assistant.service.loadBalancerSourceRanges | indent 4 }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
type: {{ .Values.assistant.service.type }}
|
||||
{{- end }}
|
||||
{{- if .Values.assistant.service.externalIPs }}
|
||||
externalIPs:
|
||||
{{ toYaml .Values.assistant.service.externalIPs | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.assistant.service.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ .Values.assistant.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.assistant.service.port }}
|
||||
protocol: TCP
|
||||
targetPort: http
|
||||
{{ if (and (eq .Values.assistant.service.type "NodePort") (not (empty .Values.assistant.service.nodePort))) }}
|
||||
nodePort: {{.Values.assistant.service.nodePort}}
|
||||
{{ end }}
|
||||
selector:
|
||||
{{- include "zigbee2mqtt.selectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
@ -51,6 +51,34 @@ spec:
|
||||
mountPath: /data
|
||||
- name: sniffer
|
||||
mountPath: {{ .Values.config.serial.port }}
|
||||
{{- if .Values.assistant.enabled }}
|
||||
- name: {{ .Chart.Name }}assistant
|
||||
image: "{{ .Values.assistant.image.repository }}:{{ .Values.assistant.image.tag | default "latest" }}"
|
||||
imagePullPolicy: {{ .Values.assistant.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: {{ .Values.assistant.probes.liveness.initialDelaySeconds }}
|
||||
failureThreshold: {{ .Values.assistant.probes.liveness.failureThreshold }}
|
||||
timeoutSeconds: {{ .Values.assistant.probes.liveness.timeoutSeconds }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: {{ .Values.assistant.probes.readiness.initialDelaySeconds }}
|
||||
failureThreshold: {{ .Values.assistant.probes.readiness.failureThreshold }}
|
||||
timeoutSeconds: {{ .Values.assistant.probes.readiness.timeoutSeconds }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "zigbee2mqtt.fullname" . }}assistant
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: zigbee2mqtt
|
||||
configMap:
|
||||
|
@ -39,8 +39,69 @@ config:
|
||||
log_output:
|
||||
- console
|
||||
|
||||
assistant:
|
||||
enabled: true
|
||||
image:
|
||||
repository: carldebilly/zigbee2mqttassistant
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is latest.
|
||||
tag: ""
|
||||
# Config values from https://github.com/yllibed/Zigbee2MqttAssistant
|
||||
# MQTT (connection or topic) parameters are retrieved from general config, but they can be overriden.
|
||||
# All of them are case insensitive.
|
||||
config:
|
||||
lowBatteryThreshold: 30
|
||||
allowJoinTimeout: 20
|
||||
autosetLastSeen: false
|
||||
devicesPollingSchedule: "*/12 * * * *"
|
||||
networkScanSchedule: "0 */3 * * *"
|
||||
|
||||
probes:
|
||||
liveness:
|
||||
initialDelaySeconds: 30
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 10
|
||||
readiness:
|
||||
initialDelaySeconds: 30
|
||||
failureThreshold: 5
|
||||
timeoutSeconds: 10
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8091
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort:
|
||||
## Provide any additional annotations which may be required. This can be used to
|
||||
## set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
annotations: {}
|
||||
labels: {}
|
||||
## Use loadBalancerIP to request a specific static IP,
|
||||
## otherwise leave blank
|
||||
##
|
||||
loadBalancerIP:
|
||||
# loadBalancerSourceRanges: []
|
||||
## Set the externalTrafficPolicy in the Service to either Cluster or Local
|
||||
# externalTrafficPolicy: Cluster
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
path: /
|
||||
hosts:
|
||||
- chart-example.local
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
persistence:
|
||||
enabled: False
|
||||
enabled: false
|
||||
annotations: {}
|
||||
## zigbee2mqtt data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
|
Loading…
Reference in New Issue
Block a user