apiVersion: apps/v1
kind: Deployment
metadata:
  name: hass
  namespace: home-assistant
  labels:
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: hass
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: home-assistant
      app.kubernetes.io/instance: hass
  template:
    metadata:
      labels:
        app.kubernetes.io/name: home-assistant
        app.kubernetes.io/instance: hass
    spec:
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      containers:
        - name: hass
          image: "homeassistant/home-assistant:2021.10.6"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8123
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
              scheme: HTTP
            initialDelaySeconds: 30
            failureThreshold: 5
            timeoutSeconds: 10
          readinessProbe:
            httpGet:
              path: /
              port: http
              scheme: HTTP
            initialDelaySeconds: 30
            failureThreshold: 5
            timeoutSeconds: 10
          volumeMounts:
          - name: config
            mountPath: /config
          - name: hass-configuration
            mountPath: /config/configuration.yaml
            subPath: configuration.yaml
          resources:
            requests:
              cpu: "200m"
              memory: "500Mi"
            limits:
              cpu: "2000m"
              memory: "2Gi"
      volumes:
      - name: config
        persistentVolumeClaim:
          claimName: hass-config
      - name: hass-configuration
        configMap:
          name: hass-configuration
          items:
            - key: configuration.yaml
              path: configuration.yaml
