diff --git a/README.md b/README.md index fe3381a92..5b32b8ba1 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ helm delete my- | [flame](charts/flame) | Flame is self-hosted startpage for your server. Easily manage your apps and bookmarks with built-in editors. | | [hammond](charts/hammond) | A self-hosted vehicle expense tracking system with support for multiple users. | | [headscale](charts/headscale) | An open source, self-hosted implementation of the Tailscale control server. | +| [home-assistant](charts/home-assistant) | Open source home automation that puts local control and privacy first. | | [homer](charts/homer) | A dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. | | [limo](charts/limo) | A file upload server. | | [matrimony](charts/matrimony) | Self-hosted wedding site configured via YAML | diff --git a/charts/home-assistant/.helmignore b/charts/home-assistant/.helmignore new file mode 100644 index 000000000..f56cea6b7 --- /dev/null +++ b/charts/home-assistant/.helmignore @@ -0,0 +1,25 @@ +# 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/ +# helm-docs templates +*.gotmpl diff --git a/charts/home-assistant/Chart.lock b/charts/home-assistant/Chart.lock new file mode 100644 index 000000000..d19217e76 --- /dev/null +++ b/charts/home-assistant/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: common + repository: https://bjw-s.github.io/helm-charts + version: 1.3.1 +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.1.14 +digest: sha256:7af4222e4b6fc98a7686d0958c1725e1a12d1027a949959a4eb089595e9be5d3 +generated: "2023-02-07T00:09:33.231143-06:00" diff --git a/charts/home-assistant/Chart.yaml b/charts/home-assistant/Chart.yaml new file mode 100644 index 000000000..578fe9d73 --- /dev/null +++ b/charts/home-assistant/Chart.yaml @@ -0,0 +1,31 @@ +apiVersion: v2 +name: home-assistant +description: Open source home automation that puts local control and privacy first. +home: https://charts.gabe565.com/charts/home-assistant/ +icon: https://raw.githubusercontent.com/home-assistant/assets/master/logo/logo-pretty.png +type: application +version: 0.0.1 +# renovate image=ghcr.io/home-assistant/home-assistant +appVersion: 2023.2.2 +kubeVersion: ">=1.22.0-0" +keywords: + - home-automation + - mqtt + - iot + - internet-of-things +dependencies: + - name: common + repository: https://bjw-s.github.io/helm-charts + version: 1.3.1 + - name: postgresql + version: 12.1.14 + repository: https://charts.bitnami.com/bitnami + condition: postgresql.enabled +sources: + - https://github.com/gabe565/charts/tree/main/charts/home-assistant + - https://home-assistant.io + - https://github.com/home-assistant/core +annotations: + artifacthub.io/changes: |- + - kind: added + description: Initial release diff --git a/charts/home-assistant/README.md b/charts/home-assistant/README.md new file mode 100644 index 000000000..390528b2b --- /dev/null +++ b/charts/home-assistant/README.md @@ -0,0 +1,149 @@ +# home-assistant + +home-assistant logo + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat) +![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat) +![AppVersion: 2023.2.2](https://img.shields.io/badge/AppVersion-2023.2.2-informational?style=flat) + +Open source home automation that puts local control and privacy first. + +**Homepage:** + +**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/gabe565/charts/issues/new)** + +## Source Code + +* +* +* + +## Requirements + +Kubernetes: `>=1.22.0-0` + +## Dependencies + +| Repository | Name | Version | +|------------|------|---------| +| | common | 1.3.1 | +| | postgresql | 12.1.14 | + +## TL;DR + +```console +helm repo add gabe565 https://charts.gabe565.com +helm repo update +helm install home-assistant gabe565/home-assistant +``` + +## Installing the Chart + +To install the chart with the release name `home-assistant` + +```console +helm install home-assistant gabe565/home-assistant +``` + +## Uninstalling the Chart + +To uninstall the `home-assistant` deployment + +```console +helm uninstall home-assistant +``` + +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/bjw-s/helm-charts/tree/main/charts/library/common/values.yaml) from the [bjw-s common library](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common). + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +```console +helm install home-assistant \ + --set env.TZ="America/New York" \ + gabe565/home-assistant +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. + +```console +helm install home-assistant gabe565/home-assistant -f values.yaml +``` + +## Custom configuration + +### HTTP 400 bad request while accessing from your browser + +When configuring Home Assistant behind a reverse proxy make sure you configure the [http](https://www.home-assistant.io/integrations/http) component and set `trusted_proxies` correctly and `use_x_forwarded_for` to `true`. + +For example (edit the configuration.yaml in your pod): + +```yaml +http: + server_host: 0.0.0.0 + ip_ban_enabled: true + login_attempts_threshold: 5 + use_x_forwarded_for: true + trusted_proxies: + # Pod CIDR + - 10.69.0.0/16 + # Node CIDR + - 192.168.42.0/24 +``` + +### USB Devices + +A USB devices can be used with Home Assistant if passed through from the host to the pod. + +The USB device could be volume bound directly into the Pod +([documented in the deprecated k8s-at-home/home-assistant chart](https://github.com/k8s-at-home/charts/tree/master/charts/stable/home-assistant#z-wave--zigbee), +but this requires granting privileged access to the Home Assistant pod. + +Instead, it is recommended to use [Smarter Device Manager](../smarter-device-manager) to manage USB devices for you. + +For example, if your Z-Wave device is at `/dev/ttyACM0`, you could deploy Smarter Device Manager with the following configuration: + +```yaml +config: | + - devicematch: ^ttyACM[0-9]*$ + nummaxdevices: 1 +``` + +Then, add the following resources to your Home Assistant `values.yaml`: + +```yaml +resources: + limits: + smarter-devices/ttyACM0: 1 + requests: + smarter-devices/ttyACM0: 1 +``` + +Your Home Assistant Pod would automatically be deployed to the correct server, with the USB device available at `/dev/ttyACM0`. +No extra privileges required! + +## Values + +**Important**: When deploying an application Helm chart you can add more values from the bjw-s common library chart [here](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common) + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| addons.codeserver | object | See [values.yaml](./values.yaml) | Enable VS Code server addon. This allows for easy access to configuration.yaml | +| dnsPolicy | string | `"Default"` | When hostNetwork is true set dnsPolicy to `ClusterFirstWithHostNet` | +| env | object | See [values.yaml](./values.yaml) | environment variables. | +| env.TZ | string | `"UTC"` | Set the container timezone | +| hostNetwork | bool | `false` | Enable devices to be discoverable | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"ghcr.io/home-assistant/home-assistant"` | image repository | +| image.tag | string | `"2023.2.2"` | image tag | +| ingress.main | object | See [values.yaml](./values.yaml) | Enable and configure ingress settings for the chart under this key. | +| persistence.config | object | See [values.yaml](./values.yaml) | Configure persistence settings for the chart under this key. | +| postgresql | object | See [values.yaml](./values.yaml) | Enable and configure postgresql database subchart under this key. For more options see [postgresql chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) | +| service | object | See [values.yaml](./values.yaml) | Configures service settings for the chart. | + +--- +Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) diff --git a/charts/home-assistant/README_CONFIG.md.gotmpl b/charts/home-assistant/README_CONFIG.md.gotmpl new file mode 100644 index 000000000..d5c6b2d3a --- /dev/null +++ b/charts/home-assistant/README_CONFIG.md.gotmpl @@ -0,0 +1,58 @@ +{{- define "custom.custom.configuration.header" -}} +## Custom configuration +{{- end -}} + +{{- define "custom.custom.configuration" -}} +{{ template "custom.custom.configuration.header" . }} + +### HTTP 400 bad request while accessing from your browser + +When configuring Home Assistant behind a reverse proxy make sure you configure the [http](https://www.home-assistant.io/integrations/http) component and set `trusted_proxies` correctly and `use_x_forwarded_for` to `true`. + +For example (edit the configuration.yaml in your pod): + +```yaml +http: + server_host: 0.0.0.0 + ip_ban_enabled: true + login_attempts_threshold: 5 + use_x_forwarded_for: true + trusted_proxies: + # Pod CIDR + - 10.69.0.0/16 + # Node CIDR + - 192.168.42.0/24 +``` + +### USB Devices + +A USB devices can be used with Home Assistant if passed through from the host to the pod. + +The USB device could be volume bound directly into the Pod +([documented in the deprecated k8s-at-home/home-assistant chart](https://github.com/k8s-at-home/charts/tree/master/charts/stable/home-assistant#z-wave--zigbee), +but this requires granting privileged access to the Home Assistant pod. + +Instead, it is recommended to use [Smarter Device Manager](../smarter-device-manager) to manage USB devices for you. + +For example, if your Z-Wave device is at `/dev/ttyACM0`, you could deploy Smarter Device Manager with the following configuration: + +```yaml +config: | + - devicematch: ^ttyACM[0-9]*$ + nummaxdevices: 1 +``` + +Then, add the following resources to your Home Assistant `values.yaml`: + +```yaml +resources: + limits: + smarter-devices/ttyACM0: 1 + requests: + smarter-devices/ttyACM0: 1 +``` + +Your Home Assistant Pod would automatically be deployed to the correct server, with the USB device available at `/dev/ttyACM0`. +No extra privileges required! + +{{- end -}} diff --git a/charts/home-assistant/templates/NOTES.txt b/charts/home-assistant/templates/NOTES.txt new file mode 100644 index 000000000..2f2c219d4 --- /dev/null +++ b/charts/home-assistant/templates/NOTES.txt @@ -0,0 +1,17 @@ +{{- include "bjw-s.common.lib.chart.notes" . -}} + +{{- with .Values.postgresql }} +{{- if .enabled }} + +Extra configuration is required to use Postgres: + +1. To get the password for "{{ default "postgres" .auth.username }}" run: + + kubectl get secret --namespace {{ $.Release.Namespace }} {{ $.Release.Name }}-postgresql -o jsonpath="{.data.{{ if not .auth.password }}postgres-{{ end }}password}" | base64 -d + +2. Add to the Home Assistant configuration.yaml: + + recorder: + db_url: postgresql://{{ default "postgres" .auth.username }}:PASSWORD@{{ $.Release.Name }}-postgresql/{{ .auth.database }} +{{- end }} +{{- end }} diff --git a/charts/home-assistant/templates/common.yaml b/charts/home-assistant/templates/common.yaml new file mode 100644 index 000000000..6eb9b68ff --- /dev/null +++ b/charts/home-assistant/templates/common.yaml @@ -0,0 +1 @@ +{{ include "bjw-s.common.loader.all" . }} diff --git a/charts/home-assistant/values.yaml b/charts/home-assistant/values.yaml new file mode 100644 index 000000000..de62bea65 --- /dev/null +++ b/charts/home-assistant/values.yaml @@ -0,0 +1,73 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/values.yaml +# + +image: + # -- image repository + repository: ghcr.io/home-assistant/home-assistant + # -- image pull policy + pullPolicy: IfNotPresent + # -- image tag + tag: 2023.2.2 + +# -- environment variables. +# @default -- See [values.yaml](./values.yaml) +env: + # -- Set the container timezone + TZ: UTC + +# -- Configures service settings for the chart. +# @default -- See [values.yaml](./values.yaml) +service: + main: + ports: + http: + port: 8123 + +ingress: + # -- Enable and configure ingress settings for the chart under this key. + # @default -- See [values.yaml](./values.yaml) + main: + enabled: false + +# -- Enable devices to be discoverable +hostNetwork: false + +# -- When hostNetwork is true set dnsPolicy to `ClusterFirstWithHostNet` +dnsPolicy: Default + +persistence: + # -- Configure persistence settings for the chart under this key. + # @default -- See [values.yaml](./values.yaml) + config: + enabled: false + +# -- Enable and configure postgresql database subchart under this key. +# For more options see [postgresql chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) +# @default -- See [values.yaml](./values.yaml) +postgresql: + enabled: false + auth: + database: home-assistant + postgresPassword: changeme + primary: + persistence: + enabled: false + +addons: + # -- Enable VS Code server addon. + # This allows for easy access to configuration.yaml + # @default -- See [values.yaml](./values.yaml) + codeserver: + enabled: false + args: + - --auth=none + - --user-data-dir=/data/config/.vscode + volumeMounts: + - name: config + mountPath: /data/config + ingress: + enabled: false