Skip to content

Commit

Permalink
[stable/home-assistant] Support zigbee, zwave, host-configs, and othe…
Browse files Browse the repository at this point in the history
…r host mounts (helm#16819)

* Allow mounting of arbitrary host volumes
Signed-off by: Zane Claes <zane@claes.biz>

Signed-off-by: Zane Claes <zane@claes.biz>

* fix deviceMounts -> hostMounts

Signed-off-by: Zane Claes <zane@claes.biz>
  • Loading branch information
zaneclaes authored and k8s-ci-robot committed Sep 4, 2019
1 parent e7ad613 commit 12558ad
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stable/home-assistant/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 0.98.0
description: Home Assistant
name: home-assistant
version: 0.9.6
version: 0.9.7
keywords:
- home-assistant
- hass
Expand Down
8 changes: 7 additions & 1 deletion stable/home-assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ The following tables lists the configurable parameters of the Home Assistant cha
| `persistence.enabled` | Use persistent volume to store data | `true` |
| `persistence.size` | Size of persistent volume claim | `5Gi` |
| `persistence.existingClaim`| Use an existing PVC to persist data | `nil` |
| `persistence.hostPath`| The path to the config directory on the host, instead of a PVC | `nil` |
| `persistence.storageClass` | Type of persistent volume claim | `-` |
| `persistence.accessMode` | Persistence access modes | `ReadWriteMany` |
| `git.enabled` | Use git-sync in init container | `false` |
| `git.secret` | Git secret to use for git-sync | `git-creds` |
| `git.secret` | Git secret to use for git-sync | `git-creds` |
| `git.syncPath` | Git sync path | `/config` |
| `git.keyPath` | Git ssh key path | `/root/.ssh` |
| `zwave.enabled` | Enable zwave host device passthrough. Also enables privileged container mode. | `false` |
| `zwave.device` | Device to passthrough to guest | `ttyACM0` |
| `hostMounts` | Array of host directories to mount; can be used for devices | [] |
| `hostMounts.name` | Name of the volume | `nil` |
| `hostMounts.hostPath` | The path on the host machine | `nil` |
| `hostMounts.mountPath` | The path at which to mount (optional; assumed same as hostPath) | `nil` |
| `hostMounts.type` | The type to mount (optional, i.e., `Directory`) | `nil` |
| `extraEnv` | Extra ENV vars to pass to the home-assistant container | `{}` |
| `extraEnvSecrets` | Extra env vars to pass to the home-assistant container from k8s secrets - see `values.yaml` for an example | `{}` |
| `configurator.enabled` | Enable the optional [configuration UI](https://github.com/danielperna84/hass-configurator) | `false` |
Expand Down
24 changes: 23 additions & 1 deletion stable/home-assistant/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ spec:
- mountPath: /dev/ttyACM0
name: ttyacm
{{- end }}
{{- range .Values.hostMounts }}
{{- if .mountPath }}
- mountPath: {{ .mountPath }}
{{- else }}
- mountPath: {{ .hostPath }}
{{- end }}
name: {{ .name }}
{{- end }}
{{- if .Values.git.enabled }}
- mountPath: {{ .Values.git.keyPath }}
name: git-secret
Expand All @@ -121,7 +129,7 @@ spec:
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.zwave.enabled }}
{{- if or .Values.zwave.enabled (.Values.hostMounts) }}
securityContext:
privileged: true
{{- end }}
Expand Down Expand Up @@ -241,8 +249,14 @@ spec:
volumes:
- name: config
{{- if .Values.persistence.enabled }}
{{- if .Values.persistence.hostPath }}
hostPath:
path: {{.Values.persistence.hostPath}}
type: Directory
{{- else }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "home-assistant.fullname" . }}{{- end }}
{{- end }}
{{- else }}
emptyDir: {}
{{ end }}
Expand All @@ -251,6 +265,14 @@ spec:
hostPath:
path: /dev/{{.Values.zwave.device}}
{{- end }}
{{- range .Values.hostMounts }}
- name: {{ .name }}
hostPath:
path: {{.hostPath}}
{{- if .type }}
type: {{ .type }}
{{- end }}
{{- end }}
{{- if .Values.git.enabled }}
- name: git-secret
secret:
Expand Down
9 changes: 9 additions & 0 deletions stable/home-assistant/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ persistence:
## If you want to reuse an existing claim, you can pass the name of the PVC using
## the existingClaim variable
# existingClaim: your-claim
##
## If you want to use a volume on the host machine instead of a PVC:
# hostPath: /path/to/the/config/folder
accessMode: ReadWriteOnce
size: 5Gi

Expand Down Expand Up @@ -102,6 +105,12 @@ zwave:
enabled: false
device: ttyACM0

# Mount devices or folders from the host machine. Can be used for USB device mounting.
hostMounts: []
# Example
# - name: zha
# hostPath: /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_6120245D-if01-port0

configurator:
enabled: false

Expand Down

0 comments on commit 12558ad

Please sign in to comment.