1
0
Fork 0

add home-assistant

This commit is contained in:
Massaki Archambault 2023-06-10 01:41:37 -04:00
parent fe0fa3913e
commit 5599645d0e
7 changed files with 163 additions and 0 deletions

View File

@ -0,0 +1,9 @@
default_config:
frontend:
themes: !include_dir_merge_named themes
http:
use_x_forwarded_for: true
trusted_proxies:
- 10.0.0.0/8

View File

@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: server
labels:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: server
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: server
template:
metadata:
labels:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: server
spec:
affinity:
nodeAffinity:
# TODO: eviction policy
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
# need a zigbee receiver
- key: badjnet.home/zigbee-receiver
operator: Exists
initContainers:
- image: busybox:1.36.1
name: cp-config
command: ["cp", "/server-config/configuration.yaml", "/config"]
volumeMounts:
- name: home-assistant-pv
mountPath: /config
- name: server-config
mountPath: /server-config
readOnly: true
containers:
- image: homeassistant/home-assistant:2023.5.4
name: home-assistant
securityContext:
privileged: true
ports:
- name: http
containerPort: 8123
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 250m
memory: 500Mi
volumeMounts:
- name: home-assistant-pv
mountPath: /config
- name: zigbee-receiver
mountPath: /dev/ttyUSB0
volumes:
- name: zigbee-receiver
hostPath:
path: /dev/ttyUSB0
- name: home-assistant-pv
persistentVolumeClaim:
claimName: server-pvc
- name: server-config
configMap:
name: server-config
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: server-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
name: server
labels:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: server
spec:
selector:
app.kubernetes.io/name: home-assistant
app.kubernetes.io/component: server
ports:
- name: http
port: 80
targetPort: http

View File

@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: server
labels:
app.kubernetes.io/name: home-assistant
probe: blackbox-http
spec:
rules:
- host: ${HOMEASSISTANT_EXTERNAL_HOST}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: server
port:
name: http

View File

@ -0,0 +1,28 @@
resources:
- home-assistant-deployment.yaml
- home-assistant-ingress.yaml
namePrefix: home-assistant-
commonLabels:
app.kubernetes.io/name: home-assistant
configMapGenerator:
- name: server-config
files:
- configuration.yaml=configurations/configuration.yaml
- name: kustomize-generated-config
literals:
- HOMEASSISTANT_EXTERNAL_HOST=hass.badjware.dev
replacements:
- source:
kind: ConfigMap
name: kustomize-generated-config
fieldPath: data.HOMEASSISTANT_EXTERNAL_HOST
targets:
- select:
kind: Ingress
name: server
fieldPaths:
- spec.rules.0.host

View File

@ -7,6 +7,7 @@ resources:
# - ../../overlays/gitlab
- ../../overlays/monitoring
- ../../overlays/nextcloud
- ../../overlays/home-assistant
# resources:
# - probes/external-services-bobcat-miner.yaml

View File

@ -0,0 +1,5 @@
resources:
- namespace.yaml
- ../../bases/home-assistant
namespace: home-assistant

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: home-assistant