[stable/home-assistant] Add AppDaemon (#21587)

* add support for additionalPorts and vseditor

- support additionalPorts
- vseditor changed logic for no passwords
- support to enable access to editor when home assistant does not start

Signed-off-by: Vegetto <git@angelnu.com>

* [home-assistant] Add AppDaemon

Leverages the support in HACS to download apps for AppDaemon.

Signed-off-by: Vegetto <git@angelnu.com>

* Fix enablement for appdaemon

Signed-off-by: Vegetto <git@angelnu.com>

* Add home-assistant config folder to appDaemon container

Signed-off-by: Vegetto <git@angelnu.com>

* increase version

Signed-off-by: Vegetto <git@angelnu.com>
This commit is contained in:
Vegetto
2020-04-04 03:45:46 -07:00
committed by GitHub
parent 8386532962
commit d6932fe553
7 changed files with 184 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 0.107.7
description: Home Assistant
name: home-assistant
version: 0.12.5
version: 0.12.6
keywords:
- home-assistant
- hass
+25
View File
@@ -144,6 +144,27 @@ The following tables lists the configurable parameters of the Home Assistant cha
| `vscode.service.externalIPs` | External IPs for the VS Code UI | `[]` |
| `vscode.service.loadBalancerIP` | Loadbalancer IP for the VS Code UI | `` |
| `vscode.service.loadBalancerSourceRanges` | Loadbalancer client IP restriction range for the VS Code UI | `[]` |
| `appdaemon.enabled` | Enable the optional [Appdaemon Sidecar](https://appdaemon.readthedocs.io/en/latest/) | `false` |
| `appdaemon.image.repository` | Image repository | `acockburn/appdaemon` |
| `appdaemon.image.tag` | Image tag | `3.0.5`|
| `appdaemon.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `appdaemon.haToken` | Home Assistant API token - you need to generate it in your Home Assistant profile and then copy here | `` |
| `appdaemon.extraEnv` | Extra ENV vars to pass to the AppDaemon container | `{}` |
| `appdaemon.ingress.enabled` | Enables Ingress for the AppDaemon UI | `false` |
| `appdaemon.ingress.annotations` | Ingress annotations for the AppDaemon UI | `{}` |
| `appdaemon.ingress.hosts` | Ingress accepted hostnames for the AppDaemonUI | `appdaemon.local` |
| `appdaemon.ingress.tls` | Ingress TLS configuration for the AppDaemon UI | `[]` |
| `appdaemon.resources` | CPU/Memory resource requests/limits for the AppDaemon | `{}` |
| `appdaemon.securityContext` | Security context to be added to hass-appdaemon container | `{}` |
| `appdaemon.service.type` | Kubernetes service type for the AppDaemon UI | `ClusterIP` |
| `appdaemon.service.port` | Kubernetes port where the AppDaemon UI is exposed| `5050` |
| `appdaemon.service.nodePort` | nodePort to listen on for the AppDaemon UI | `` |
| `appdaemon.service.annotations` | Service annotations for the AppDaemon UI | `{}` |
| `appdaemon.service.labels` | Service labels to use for the AppDaemon UI | `{}` |
| `appdaemon.service.clusterIP` | Cluster IP for the AppDaemon UI | `` |
| `appdaemon.service.externalIPs` | External IPs for the AppDaemon UI | `[]` |
| `appdaemon.service.loadBalancerIP` | Loadbalancer IP for the AppDaemon UI | `` |
| `appdaemon.service.loadBalancerSourceRanges` | Loadbalancer client IP restriction range for the VS Code UI | `[]` |
| `resources` | CPU/Memory resource requests/limits or the home-assistant GUI | `{}` |
| `nodeSelector` | Node labels for pod assignment or the home-assistant GUI | `{}` |
| `tolerations` | Toleration labels for pod assignment or the home-assistant GUI | `[]` |
@@ -190,6 +211,10 @@ Much of the home assistant configuration occurs inside the various files persist
[VS Code Server](https://github.com/cdr/code-server) is added as an optional sidecar container to Home Assistant with access to the home assistant configuration for easy in-browser editing and manipulation of Home Assistant. If using this, it is possible to manually install the [Home Assistant Config Helper Extension](https://github.com/keesschollaart81/vscode-home-assistant) in order to have a deeper integration with Home Assistant within VS Code while editing the configuration files.
### AppDaemon
[AppDaemon](https://www.home-assistant.io/docs/ecosystem/appdaemon/) is added as an optional sidecar container to Home Assistant with access to the home assistant configuration `/config/appdaemon`. This allows downloading apps with [HACS](https://github.com/hacs/integration)
[Home Assistant Configurator UI](https://github.com/danielperna84/hass-configurator) is added as an optional sidecar container to Home Assistant with access to the home assistant configuration for easy in-browser editing and manipulation of Home Assistant.
## Git sync secret
In order to sync the home assistant from a git repo, you have to store a ssh key as a kubernetes git secret
@@ -0,0 +1,39 @@
{{- if (.Values.appdaemon.enabled) and (.Values.appdaemon.ingress.enabled) }}
{{- $fullName := include "home-assistant.fullname" . -}}
{{- $servicePort := .Values.appdaemon.service.port -}}
{{- $ingressPath := .Values.appdaemon.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}-appdaemon
labels:
app.kubernetes.io/name: {{ include "home-assistant.name" . }}
helm.sh/chart: {{ include "home-assistant.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.appdaemon.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.appdaemon.ingress.tls }}
tls:
{{- range .Values.appdaemon.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.appdaemon.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
@@ -270,6 +270,52 @@ spec:
resources:
{{ toYaml .Values.vscode.resources | indent 12 }}
{{- end }}
{{- if .Values.appdaemon.enabled }}
- name: appdaemon
image: "{{ .Values.appdaemon.image.repository }}:{{ .Values.appdaemon.image.tag }}"
imagePullPolicy: {{ .Values.appdaemon.image.pullPolicy }}
ports:
- name: appdaemon
containerPort: {{ .Values.appdaemon.service.port }}
protocol: TCP
env:
- name: HA_URL
value: "http://localhost:{{ .Values.service.port }}"
{{- if .Values.appdaemon.ingress.enabled }}
- name: DASH_URL
#value: http{{ if .Values.appdaemon.ingress.tls }}s{{ end }}://{{ index .Values.appdaemon.ingress.hosts 0 }}
value: http://0.0.0.0:{{ .Values.appdaemon.service.port }}
{{- end }}
{{- if .Values.appdaemon.haToken }}
- name: TOKEN
valueFrom:
secretKeyRef:
name: {{ template "home-assistant.fullname" . }}-appdaemon
key: token
{{- end }}
{{- range $key, $value := .Values.vscode.extraEnv }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
volumeMounts:
- mountPath: /ha-conf
name: config
- mountPath: /conf
subPath: appdaemon
name: config
{{- if .Values.extraVolumeMounts }}{{ toYaml .Values.extraVolumeMounts | trim | nindent 10 }}{{ end }}
{{- if .Values.usePodSecurityContext }}
securityContext:
runAsUser: {{ default 0 .Values.runAsUser }}
{{- if and (.Values.runAsUser) (.Values.fsGroup) }}
{{- if not (eq .Values.runAsUser 0.0) }}
fsGroup: {{ .Values.fsGroup }}
{{- end }}
{{- end }}
{{- end }}
resources:
{{ toYaml .Values.appdaemon.resources | indent 12 }}
{{- end }}
volumes:
- name: config
{{- if .Values.persistence.enabled }}
+18 -1
View File
@@ -36,4 +36,21 @@ data:
{{- if .Values.vscode.password }}
password: {{ .Values.vscode.password | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
---
{{- if .Values.appdaemon.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "home-assistant.fullname" . }}-appdaemon
labels:
app.kubernetes.io/name: {{ include "home-assistant.name" . }}
helm.sh/chart: {{ include "home-assistant.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
data:
{{- if .Values.appdaemon.haToken }}
token: {{ .Values.appdaemon.haToken | b64enc | quote }}
{{- end }}
{{- end }}
@@ -63,6 +63,15 @@ spec:
nodePort: {{.Values.vscode.service.nodePort}}
{{ end }}
{{- end }}
{{- if .Values.appdaemon.enabled }}
- name: appdaemon
port: {{ .Values.appdaemon.service.port }}
protocol: TCP
targetPort: 5050
{{ if (and (eq .Values.appdaemon.service.type "NodePort") (not (empty .Values.appdaemon.service.nodePort))) }}
nodePort: {{.Values.appdaemon.service.nodePort}}
{{ end }}
{{- end }}
{{- if .Values.service.additionalPorts }}
{{- .Values.service.additionalPorts | toYaml | indent 4 }}
{{- end }}
+46 -1
View File
@@ -34,7 +34,7 @@ service:
type: ClusterIP
port: 8123
portName: api
additionalPorts: {}
additionalPorts: []
# - name: homematicproxy
# port: 2001
# targetPort: 2001
@@ -263,6 +263,51 @@ vscode:
loadBalancerSourceRanges: []
# nodePort: 30000
appdaemon:
enabled: false
## code-server container image
##
image:
repository: acockburn/appdaemon
tag: 3.0.5
pullPolicy: IfNotPresent
## Home Assistant API token
# haToken:
## Additional hass-vscode container environment variable
## For instance to add a http_proxy
##
extraEnv: {}
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- appdaemon.local
tls: []
# - secretName: appdaemon-tls
# hosts:
# - appdaemon.local
service:
type: ClusterIP
port: 5050
annotations: {}
labels: {}
clusterIP: ""
## List of IP addresses at which the hass-appdaemon service is available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
# nodePort: 30000
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