1
0
Fork 0
home-stack-kustomize/kustomize/bases/home-assistant/home-assistant-deployment.yaml

97 lines
2.4 KiB
YAML

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: badjware.dev/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
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