apiVersion: apps/v1
kind: Deployment
metadata:
  name: diun-deployment
  labels:
    app: diun
spec:
  revisionHistoryLimit: 0
  replicas: 1
  selector:
    matchLabels:
      app: diun
  template:
    metadata:
      labels:
        app: diun
    spec:
      imagePullSecrets:
        - name: registry.internal.aleemhaji.com
      containers:
        - name: diun
          image: registry.internal.aleemhaji.com/diun:4.16.1
          command:
            - sh
            - -eufc
            - |
              wget -O- https://raw.githubusercontent.com/Eagerod/home-network/master/hope.yaml 2> /dev/null |\
              grep source: | \
              sed -r 's/[[:space:]]*source:/- name:/' > /diun.yaml && 
              printf 'db:\n  path: diun.db\n' > /config.yaml && \
              diun --config config.yaml
          env:
            - name: TZ
              value: "America/Toronto"
            - name: LOG_LEVEL
              value: "debug"
            - name: LOG_JSON
              value: "false"
            - name: DIUN_WATCH_WORKERS
              value: "20"
            - name: DIUN_WATCH_SCHEDULE
              value: "0 */6 * * *"
            - name: DIUN_NOTIF_SLACK_WEBHOOKURL 
              valueFrom:
                secretKeyRef:
                  name: diun-secrets
                  key: webhook_url
            - name: DIUN_PROVIDERS_FILE_FILENAME
              value: /diun.yaml
            - name: DIUN_WATCH_FIRSTCHECKNOTIF
              value: "true"
