[zigbee2mqtt] Version 1.15, new UI (#80)

This commit is contained in:
Piotr Maksymiuk 2020-10-04 19:23:07 +02:00 committed by GitHub
parent e19708e37d
commit e60063a352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 163 deletions

View File

@ -2,8 +2,8 @@ apiVersion: v2
name: zigbee2mqtt
type: application
description: Bridges events and allows you to control your Zigbee devices via MQTT
appVersion: 1.14.1
version: 1.0.0
appVersion: 1.15.0
version: 2.0.0
keywords:
- zigbee
- mqtt

View File

@ -64,3 +64,21 @@ Alternatively, a YAML file that specifies the values for the above parameters ca
```console
helm install --name my-release -f values.yaml k8s-at-home/zigbee2mqtt
```
## Upgrading an existing Release to a new major version
A major chart version change (like 1.0.0 -> 2.0.0) indicates that there is an
incompatible breaking change needing manual actions.
### Upgrading from 1.x.x to 2.x.x
Zigbee2MQTT has gained a native full-feature WebUI. Because of this, Zigbee2MQTTAssistant was dropped from the chart
You should delete the assistant config from your values.yaml. If you wish to use the new UI, make sure you have
```
frontend:
port: 8080
experimental:
new_api: true
```
in the config section, and enable the ingress in values.yaml. Because of the way this chart works, you'll need to add this section to your configuration.yaml in zigbee2mqtt manually if you want to upgrade in-place

View File

@ -7,24 +7,26 @@ 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 }}
{{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
Get the Zigbee2MQTT WebUI URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.assistant.service.type }}
{{- else if contains "NodePort" .Values.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 }}
{{- else if contains "LoadBalancer" .Values.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 }}
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.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 }}
{{- end }}

View File

@ -9,40 +9,3 @@ 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 }}

View File

@ -1,20 +1,21 @@
{{- if and .Values.assistant.enabled .Values.assistant.ingress.enabled -}}
{{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
{{- $fullName := include "zigbee2mqtt.fullname" . -}}
{{- $ingressPath := .Values.assistant.ingress.path -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{ include "zigbee2mqtt.labels" . | indent 4 }}
{{- with .Values.assistant.ingress.annotations }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.assistant.ingress.tls }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.assistant.ingress.tls }}
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
@ -23,7 +24,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.assistant.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
@ -32,4 +33,5 @@ spec:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,50 +1,52 @@
{{- if .Values.assistant.enabled -}}
{{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
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 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
{{- with .Values.assistant.service.annotations }}
{{- with .Values.service.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if (or (eq .Values.assistant.service.type "ClusterIP") (empty .Values.assistant.service.type)) }}
{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
type: ClusterIP
{{- if .Values.assistant.service.clusterIP }}
clusterIP: {{ .Values.assistant.service.clusterIP }}
{{- if .Values.service.clusterIP }}
clusterIP: {{ .Values.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 }}
{{- else if eq .Values.service.type "LoadBalancer" }}
type: {{ .Values.service.type }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.assistant.service.loadBalancerSourceRanges }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.assistant.service.loadBalancerSourceRanges | indent 4 }}
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
{{- end -}}
{{- else }}
type: {{ .Values.assistant.service.type }}
type: {{ .Values.service.type }}
{{- end }}
{{- if .Values.assistant.service.externalIPs }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.assistant.service.externalIPs | indent 4 }}
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.assistant.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.assistant.service.externalTrafficPolicy }}
{{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
ports:
- name: http
port: {{ .Values.assistant.service.port }}
port: {{ .Values.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}}
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.service.nodePort}}
{{ end }}
selector:
{{- include "zigbee2mqtt.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -41,6 +41,14 @@ spec:
- name: DEBUG
value: {{ .Values.debug }}
{{- end }}
{{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
ports:
- name: http
containerPort: {{ .Values.config.frontend.port }}
protocol: TCP
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
@ -51,34 +59,6 @@ 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:

View File

@ -39,66 +39,45 @@ 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 * * *"
# Both of these need to be enabled for the webui
frontend:
port: 8080
experimental:
new_api: true
probes:
liveness:
initialDelaySeconds: 30
failureThreshold: 5
timeoutSeconds: 10
readiness:
initialDelaySeconds: 30
failureThreshold: 5
timeoutSeconds: 10
service:
type: ClusterIP
port: 8080
## 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
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
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