---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: esphome
  labels:
    app.kubernetes.io/name: esphome
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: esphome
  template:
    metadata:
      labels:
        app.kubernetes.io/name: esphome
    spec:
      serviceAccountName: default
      automountServiceAccountToken: true
      dnsPolicy: ClusterFirstWithHostNet
      hostNetwork: true
      enableServiceLinks: true
      containers:
        - name: release-name-esphome
          image: "esphome/esphome:2022.6.1"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 6052
              protocol: TCP
          volumeMounts:
            - name: esphome-configs
              mountPath: /config
          livenessProbe:
            tcpSocket:
              port: 6052
            initialDelaySeconds: 0
            failureThreshold: 3
            timeoutSeconds: 1
            periodSeconds: 10
          readinessProbe:
            tcpSocket:
              port: 6052
            initialDelaySeconds: 0
            failureThreshold: 3
            timeoutSeconds: 1
            periodSeconds: 10
          startupProbe:
            tcpSocket:
              port: 6052
            initialDelaySeconds: 0
            failureThreshold: 30
            timeoutSeconds: 1
            periodSeconds: 5
          envFrom:
            - secretRef:
                name: esphome-secrets
      volumes:
        - name: esphome-configs
          persistentVolumeClaim:
            claimName: esphome-config
