Add Home Assistant chart
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{{- define "ha.labels" -}}
|
||||
app.kubernetes.io/name: homeassistant
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "ha.selectorLabels" -}}
|
||||
app.kubernetes.io/name: homeassistant
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: homeassistant-seed
|
||||
labels:
|
||||
{{- include "ha.labels" . | nindent 4 }}
|
||||
data:
|
||||
configuration.yaml: |
|
||||
{{- .Values.seedConfiguration | nindent 4 }}
|
||||
@@ -0,0 +1,82 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: homeassistant
|
||||
labels:
|
||||
{{- include "ha.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: 1
|
||||
# RWO volume + hostNetwork port: the old pod must be gone before the new one starts.
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ha.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ha.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
hostNetwork: {{ .Values.hostNetwork }}
|
||||
# Keep cluster DNS (service names) working with hostNetwork.
|
||||
dnsPolicy: {{ ternary "ClusterFirstWithHostNet" "ClusterFirst" .Values.hostNetwork }}
|
||||
initContainers:
|
||||
# Seed configuration.yaml (incl. reverse-proxy settings) on first start only.
|
||||
- name: seed-config
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
if [ ! -f /config/configuration.yaml ]; then
|
||||
cp /seed/configuration.yaml /config/configuration.yaml
|
||||
echo "seeded configuration.yaml"
|
||||
fi
|
||||
# Files included by the seeded configuration.yaml (same defaults as HA's onboarding).
|
||||
[ -f /config/automations.yaml ] || echo "[]" > /config/automations.yaml
|
||||
touch /config/scripts.yaml /config/scenes.yaml
|
||||
mkdir -p /config/themes
|
||||
volumeMounts:
|
||||
- {name: config, mountPath: /config}
|
||||
- {name: seed, mountPath: /seed}
|
||||
containers:
|
||||
- name: homeassistant
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
env:
|
||||
- name: TZ
|
||||
value: {{ .Values.tz | quote }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.port }}
|
||||
{{- if .Values.privileged }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
{{- end }}
|
||||
startupProbe:
|
||||
tcpSocket: {port: http}
|
||||
periodSeconds: 10
|
||||
failureThreshold: 60
|
||||
livenessProbe:
|
||||
tcpSocket: {port: http}
|
||||
periodSeconds: 30
|
||||
failureThreshold: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- {name: config, mountPath: /config}
|
||||
{{- range $i, $d := .Values.devices }}
|
||||
- {name: dev-{{ $i }}, mountPath: {{ $d }}}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: homeassistant-config
|
||||
- name: seed
|
||||
configMap:
|
||||
name: homeassistant-seed
|
||||
{{- range $i, $d := .Values.devices }}
|
||||
- name: dev-{{ $i }}
|
||||
hostPath:
|
||||
path: {{ $d }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,29 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: homeassistant
|
||||
labels:
|
||||
{{- include "ha.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: {{ .Values.ingress.clusterIssuer }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
tls:
|
||||
- hosts: [{{ .Values.ingress.host }}]
|
||||
secretName: homeassistant-tls
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: homeassistant
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: homeassistant-config
|
||||
labels:
|
||||
{{- include "ha.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
# Never delete the config (users, integrations, history) on uninstall/prune.
|
||||
helm.sh/resource-policy: keep
|
||||
argocd.argoproj.io/sync-options: Delete=false
|
||||
spec:
|
||||
accessModes: [ReadWriteOnce]
|
||||
{{- with .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: homeassistant
|
||||
labels:
|
||||
{{- include "ha.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ha.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.port }}
|
||||
targetPort: http
|
||||
Reference in New Issue
Block a user