apiVersion: apps/v1
kind: Deployment
metadata:
  name: adguard-home
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/instance: adguard
      app.kubernetes.io/name: adguard-home
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: adguard
        app.kubernetes.io/name: adguard-home
    spec:
      containers:
      - command:
        - "sh"
        - "-c"
        - >
          cp /config/AdGuardHome.yaml /opt/adguardhome/conf/AdGuardHome.yaml &&
          sleep 5 &&
          /opt/adguardhome/AdGuardHome --no-check-update --config /opt/adguardhome/conf/AdGuardHome.yaml
      # - args:
      #   - --config
      #   - /opt/adguardhome/conf/AdGuardHome.yaml
      #   - --work-dir
      #   - /opt/adguardhome/work
      #   - --no-check-update
        env:
        - name: TZ
          value: Europe/Berlin
        image: adguard/adguardhome
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        name: adguard-home
        ports:
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
        - containerPort: 53
          name: dns-udp
          protocol: UDP
        - containerPort: 3000
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        resources: {}
        startupProbe:
          failureThreshold: 30
          periodSeconds: 5
          successThreshold: 1
          tcpSocket:
            port: 3000
          timeoutSeconds: 1
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /config/AdGuardHome.yaml
          name: adguard-home-config
          subPath: AdGuardHome.yaml
      dnsPolicy: ClusterFirst

      restartPolicy: Always

      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 0777
          name: adguard-home-config
        name: adguard-home-config