apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  template:
    spec:
      tolerations:
        - key: "public"
          operator: "Equal"
          value: "true"
          effect: "NoSchedule"
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              preference:
                matchExpressions:
                  - key: public
                    operator: In
                    values:
                      - "true"
      serviceAccountName: diun
      containers:
        - name: diun
          image: crazymax/diun:latest
          imagePullPolicy: Always
          args: ["serve"]
          envFrom:
            - configMapRef:
                name: diun-config
          env:
            - name: DIUN_NOTIF_NTFY_TOKEN
              valueFrom:
                secretKeyRef:
                  name: diun-secrets
                  key: DIUN_NTFY_TOKEN
            - name: DIUN_NOTIF_NTFY_TOPIC
              valueFrom:
                secretKeyRef:
                  name: diun-secrets
                  key: DIUN_NTFY_TOPIC
          volumeMounts:
            - mountPath: "/data"
              name: diun-data
              subPath: data
      restartPolicy: Always
      volumes:
        # Set up a data directory for diun
        # For production usage, you should consider using PV/PVC instead(or simply using storage like NAS)
        # For more details, please see https://kubernetes.io/docs/concepts/storage/volumes/
        - name: diun-data
          persistentVolumeClaim:
            claimName: diun-pvc