From 2e16ffc1e47cd4c2395b363922ba6a53eb2e2fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Sun, 3 Nov 2024 21:06:21 +0100 Subject: [PATCH] add wmbusmeters --- charts/wmbusmeters/.helmignore | 26 +++++ charts/wmbusmeters/Chart.lock | 6 ++ charts/wmbusmeters/Chart.yaml | 22 ++++ charts/wmbusmeters/README.md | 117 +++++++++++++++++++++ charts/wmbusmeters/README_CONFIG.md.gotmpl | 45 ++++++++ charts/wmbusmeters/ci/ct-values.yaml | 9 ++ charts/wmbusmeters/templates/NOTES.txt | 1 + charts/wmbusmeters/templates/common.yaml | 5 + charts/wmbusmeters/values.yaml | 58 ++++++++++ 9 files changed, 289 insertions(+) create mode 100644 charts/wmbusmeters/.helmignore create mode 100644 charts/wmbusmeters/Chart.lock create mode 100644 charts/wmbusmeters/Chart.yaml create mode 100644 charts/wmbusmeters/README.md create mode 100644 charts/wmbusmeters/README_CONFIG.md.gotmpl create mode 100644 charts/wmbusmeters/ci/ct-values.yaml create mode 100644 charts/wmbusmeters/templates/NOTES.txt create mode 100644 charts/wmbusmeters/templates/common.yaml create mode 100644 charts/wmbusmeters/values.yaml diff --git a/charts/wmbusmeters/.helmignore b/charts/wmbusmeters/.helmignore new file mode 100644 index 0000000..4379e2b --- /dev/null +++ b/charts/wmbusmeters/.helmignore @@ -0,0 +1,26 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# OWNERS file for Kubernetes +OWNERS +# helm-docs templates +*.gotmpl diff --git a/charts/wmbusmeters/Chart.lock b/charts/wmbusmeters/Chart.lock new file mode 100644 index 0000000..3cfc526 --- /dev/null +++ b/charts/wmbusmeters/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://library-charts.k8s-at-home.com + version: 4.5.2 +digest: sha256:408d12aa9bbce6dfd4ced5c2586d92dfa518821e01823081fa9a141243b3160c +generated: "2022-12-04T22:58:52.344926901+01:00" diff --git a/charts/wmbusmeters/Chart.yaml b/charts/wmbusmeters/Chart.yaml new file mode 100644 index 0000000..7111b5d --- /dev/null +++ b/charts/wmbusmeters/Chart.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: v2 +appVersion: 1.17.1 +description: Read the wired or wireless mbus protocol to acquire utility meter readings. +name: wmbusmeters +version: 1.0.0 +kubeVersion: ">=1.16.0-0" +keywords: + - m-bus + - wm-bus + - mqtt + - home-assistant +home: https://github.com/andrenarchy/helm-charts/tree/main/charts/wmbusmeters +sources: + - https://github.com/wmbusmeters/wmbusmeters +maintainers: + - name: André Gaul + email: andre@gaul.io +dependencies: + - name: common + repository: https://library-charts.k8s-at-home.com + version: 4.5.2 diff --git a/charts/wmbusmeters/README.md b/charts/wmbusmeters/README.md new file mode 100644 index 0000000..ff8a94b --- /dev/null +++ b/charts/wmbusmeters/README.md @@ -0,0 +1,117 @@ +# wmbusmeters + +Read the wired or wireless mbus protocol to acquire utility meter readings. + +## Source Code + +* + +## Requirements + +Kubernetes: `>=1.16.0-0` + +## Dependencies + +| Repository | Name | Version | +|------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 4.5.2 | + +## TL;DR + +```console +helm repo add andrenarchy https://andrenarchy.github.io/helm-charts/ +helm repo update +helm install wmbusmeters andrenarchy/wmbusmeters +``` + +## Installing the Chart + +To install the chart with the release name `wmbusmeters` + +```console +helm install wmbusmeters andrenarchy/wmbusmeters +``` + +## Uninstalling the Chart + +To uninstall the `wmbusmeters` deployment + +```console +helm uninstall wmbusmeters +``` + +The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release. + +## Configuration + +Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. +Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common). + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +```console +helm install wmbusmeters \ + --set env.TZ="America/New York" \ + andrenarchy/wmbusmeters +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. + +```console +helm install wmbusmeters andrenarchy/wmbusmeters -f values.yaml +``` + +## Custom configuration + +**IMPORTANT NOTE:** a radio device must be accessible on the node where this pod runs, in order for this chart to function properly. + +First, you will need to mount your radio device into the pod, you can do so by adding the following to your values: + +```yaml +additionalVolumeMounts: + - name: usb + mountPath: /path/to/device + +additionalVolumes: + - name: usb + hostPath: + path: /path/to/device +``` + +Second you will need to set a nodeAffinity rule, for example: + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: app + operator: In + values: + - wmbus-radio +``` + +... where a node with an attached radio device is labeled with `app: wmbus-radio` + +If you are getting errors, that the device cannot be opened when starting wmbusmeters, try uncommenting the privileged flag: + +``` +securityContext: + privileged: true +``` + +## Values + +**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common) + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity constraint rules to place the Pod on a specific node. [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"wmbusmeters/wmbusmeters"` | image repository | +| image.tag | string | `"1.17.1"` | image tag | +| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. | +| persistence.usb | object | See values.yaml | Configure a hostPathMount to mount a USB device in the container. | +| securityContext.privileged | bool | `nil` | Privileged securityContext may be required if USB controller is accessed directly through the host machine | +| service | object | See values.yaml | Configures service settings for the chart. Normally this does not need to be modified. | diff --git a/charts/wmbusmeters/README_CONFIG.md.gotmpl b/charts/wmbusmeters/README_CONFIG.md.gotmpl new file mode 100644 index 0000000..219fffc --- /dev/null +++ b/charts/wmbusmeters/README_CONFIG.md.gotmpl @@ -0,0 +1,45 @@ +{{- define "custom.custom.configuration.header" -}} +## Custom configuration +{{- end -}} + +{{- define "custom.custom.configuration" -}} +{{ template "custom.custom.configuration.header" . }} + +**IMPORTANT NOTE:** a radio device must be accessible on the node where this pod runs, in order for this chart to function properly. + +First, you will need to mount your radio device into the pod, you can do so by adding the following to your values: + +```yaml +additionalVolumeMounts: + - name: usb + mountPath: /path/to/device + +additionalVolumes: + - name: usb + hostPath: + path: /path/to/device +``` + +Second you will need to set a nodeAffinity rule, for example: + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: app + operator: In + values: + - wmbus-radio +``` + +... where a node with an attached radio device is labeled with `app: wmbus-radio` + +If you are getting errors, that the device cannot be opened when starting wmbusmeters, try uncommenting the privileged flag: + +``` +securityContext: + privileged: true +``` +{{- end -}} diff --git a/charts/wmbusmeters/ci/ct-values.yaml b/charts/wmbusmeters/ci/ct-values.yaml new file mode 100644 index 0000000..1130367 --- /dev/null +++ b/charts/wmbusmeters/ci/ct-values.yaml @@ -0,0 +1,9 @@ +ingress: + main: + enabled: true + +persistence: + data: + enabled: true + type: emptyDir + mountPath: /wmbusmeters_data diff --git a/charts/wmbusmeters/templates/NOTES.txt b/charts/wmbusmeters/templates/NOTES.txt new file mode 100644 index 0000000..90f7b65 --- /dev/null +++ b/charts/wmbusmeters/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/wmbusmeters/templates/common.yaml b/charts/wmbusmeters/templates/common.yaml new file mode 100644 index 0000000..64e027a --- /dev/null +++ b/charts/wmbusmeters/templates/common.yaml @@ -0,0 +1,5 @@ +{{/* Make sure all variables are set properly */}} +{{- include "common.values.setup" . }} + +{{/* Render the templates */}} +{{ include "common.all" . }} diff --git a/charts/wmbusmeters/values.yaml b/charts/wmbusmeters/values.yaml new file mode 100644 index 0000000..33b457c --- /dev/null +++ b/charts/wmbusmeters/values.yaml @@ -0,0 +1,58 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml +# + +image: + # -- image repository + repository: wmbusmeters/wmbusmeters + # -- image tag + # note: 1.17.1 does not support iu891a yet! latest does... + # tag: release-1.17.1 + tag: latest + # -- image pull policy + pullPolicy: IfNotPresent + +securityContext: + # -- (bool) Privileged securityContext may be required if USB controller is accessed directly through the host machine + privileged: # true + +# -- Configure persistence settings for the chart under this key. +# @default -- See values.yaml +persistence: + data: + enabled: false + mountPath: /wmbusmeters_data + # -- Configure a hostPathMount to mount a USB device in the container. + # @default -- See values.yaml + usb: + enabled: false + type: hostPath + hostPath: /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2400981-if00 + +# -- Affinity constraint rules to place the Pod on a specific node. +# [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) +affinity: {} +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: app +# operator: In +# values: +# - wmbus-radio + +service: + main: + enabled: false + +probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + \ No newline at end of file