apiVersion: apps/v1
kind: Deployment
metadata:
  name: ddns
  labels:
    app: ddns
  annotations:
    keel.sh/policy: "force"
    keel.sh/match-tag: "true"
    keel.sh/trigger: "poll"
    keel.sh/pollSchedule: "@daily"
spec:
  replicas: 1
  revisionHistoryLimit: 0
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: ddns
  template:
    metadata:
      labels:
        app: ddns
    spec:
      initContainers:
        - name: init-config
          image: dibi/envsubst:latest
          env:
            - name: CLOUDFLARE_TOKEN
              valueFrom:
                secretKeyRef:
                  name: ddns-secret
                  key: cloudflare_token
          volumeMounts:
            - name: config-volume
              mountPath: /processed
            - name: workdir-volume
              mountPath: /workdir
      containers:
        - name: ddns
          image: qmcgaw/ddns-updater:latest
          env:
            - name: TZ
              value: "Europe/Warsaw"
          ports:
            - containerPort: 8000
          volumeMounts:
            - name: config-volume
              mountPath: /updater/data
      volumes:
        - name: workdir-volume
          configMap:
            name: ddns-config
        - name: config-volume
          emptyDir: {}
