[zigbee2mqtt] Add chart (#283)

* [zigbee2mqtt] Add chart

* remove remnants of zwave from chart

* fix lint

* one more zwave in zigbee

* set default timezone to UTC
This commit is contained in:
Piotr Maksymiuk 2020-07-17 15:31:15 +02:00 committed by GitHub
parent 2de424be2d
commit c0da502c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 408 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,16 @@
apiVersion: v2
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
keywords:
- zigbee
- mqtt
home: https://www.zigbee2mqtt.io
icon: https://www.zigbee2mqtt.io/images/logo.png
sources:
- https://github.com/Koenkk/zigbee2mqtt
maintainers:
- name: ishioni
email: helm@movishell.pl

View File

@ -0,0 +1,66 @@
# zigbee2mqtt: Fully configurable Zigbee to MQTT Gateway
This is a helm chart for [zigbee2mqtt](https://www.zigbee2mqtt.io)
## TL;DR;
```shell
$ helm repo add billimek https://billimek.com/billimek-charts/
$ helm install billimek/zigbee2mqtt
```
## Installing the Chart
To install the chart with the release name `my-release`:
```console
helm install --name my-release billimek/zigbee2mqtt
```
**IMPORTANT NOTE:** a [supported Zigbee sniffer](https://www.zigbee2mqtt.io/getting_started/what_do_i_need.html) must be accessible on the node where this pod runs, in order for this chart to function properly.
A way to achieve this can be with nodeAffinity rules, for example:
```yaml
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- zigbee-controller
```
... where a node with an attached zigbee sniffer is labeled with `app: zigbee-controller`
Because zigbee2mqtt writes to the config file, it is impossible to manage it through this chart. The configuration options will be set as defaults on first run, and then copied to a writeable directory. It can be found in /data/configuration.yaml afterwards.
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```console
helm delete my-release --purge
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
Read through the [values.yaml](https://github.com/billimek/billimek-charts/blob/master/charts/zigbee2mqtt/values.yaml) file. It has several commented out suggested values.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
helm install --name my-release \
--set config.mqtt.server="mqtt://mymqttbroker" \
billimek/zigbee2mqtt
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
```console
helm install --name my-release -f values.yaml billimek/zigbee2mqtt
```

View File

@ -0,0 +1,9 @@
{{- if not .Values.persistence.enabled }}
WARNING: You have disabled persistence. Your pairings and settings will be lost on container restart!
{{- else }}
Your setting will be applied on first start, and cannot be managed from this chart
{{- if not .Values.config.advanced.network_key }}
WARNING: You have not set a network key, which makes zigbee2mqtt run with a well-known network key. This is highly insecure.
Please read https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
{{- end }}
{{- end }}

View File

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "zigbee2mqtt.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "zigbee2mqtt.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "zigbee2mqtt.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "zigbee2mqtt.labels" -}}
helm.sh/chart: {{ include "zigbee2mqtt.chart" . }}
{{ include "zigbee2mqtt.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "zigbee2mqtt.selectorLabels" -}}
app.kubernetes.io/name: {{ include "zigbee2mqtt.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "zigbee2mqtt.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "zigbee2mqtt.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}
labels:
{{ include "zigbee2mqtt.labels" . | indent 4 }}
data:
configuration.yaml: |
{{- with .Values.config }}
{{- toYaml . | nindent 4 }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "zigbee2mqtt.serviceAccountName" . }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,105 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}
labels:
{{- include "zigbee2mqtt.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "zigbee2mqtt.selectorLabels" . | nindent 6 }}
serviceName: {{ include "zigbee2mqtt.name" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "zigbee2mqtt.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "zigbee2mqtt.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: ZIGBEE2MQTT_DATA
value: "/data"
- name: TZ
value: {{ .Values.timezone }}
{{- if .Values.debug }}
- name: DEBUG
value: {{ .Values.debug }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: zigbee2mqtt
mountPath: /app/configuration.yaml
subPath: configuration.yaml
- name: data
mountPath: /data
- name: sniffer
mountPath: {{ .Values.config.serial.port }}
volumes:
- name: zigbee2mqtt
configMap:
name: {{ include "zigbee2mqtt.fullname" . }}
- name: sniffer
hostPath:
path: {{ required "You must specify a path to your zigbee sniffer" .Values.config.serial.port }}
{{- if not .Values.persistence.enabled }}
- name: data
emptyDir: {}
{{- end }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
- metadata:
name: data
labels:
app.kubernetes.io/name: {{ include "zigbee2mqtt.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.persistence.annotations }}
annotations:
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- end }}
spec:
accessModes: [ {{ .Values.persistence.accessMode | quote }} ]
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,103 @@
# Default values for zigbee2mqtt.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
repository: koenkk/zigbee2mqtt
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
timezone: "UTC"
# Enable zigbee-herdsman debuggin
# debug: "zigbee-herdsman*"
config:
# These will be applied ONLY on first run
# Home Assistant integration (MQTT discovery)
homeassistant: false
# allow new devices to join
permit_join: true
# MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: zigbee2mqtt
# MQTT server URL
server: 'mqtt://localhost'
# MQTT server authentication, uncomment if required:
# user: my_user
# password: my_password
# Serial settings
serial:
# Location of CC2531 USB sniffer
port: /dev/ttyACM0
advanced:
network_key: GENERATE
log_output:
- console
persistence:
enabled: False
annotations: {}
## zigbee2mqtt data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
##
## If you want to reuse an existing claim, you can pass the name of the PVC using
## the existingClaim variable
# existingClaim: zigbee2mqtt-data
accessMode: ReadWriteOnce
size: 100Mi
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext:
privileged: true
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}