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"
      containers:
        - name: ntfy
          image: binwiederhier/ntfy:v2.11.0 # set deployed version
          args: ["serve"]
          ports:
            - containerPort: 80
              name: ntfy
          resources:
            limits:
              memory: 300Mi
              cpu: 200m
            requests:
              cpu: 150m
              memory: 150Mi
          volumeMounts:
            - mountPath: /var/cache/ntfy
              name: ntfy-data
              subPath: "data"
          envFrom:
            - configMapRef:
                name: ntfy-config
          env:
            - name: NTFY_WEB_PUSH_PRIVATE_KEY
              valueFrom:
                secretKeyRef:
                  name: ntfy-secrets
                  key: VAPID_PRIVATE_KEY
                  optional: false
          livenessProbe:
            httpGet:
              path: /v1/health
              port: ntfy
          readinessProbe:
            httpGet:
              path: /v1/health
              port: ntfy
          startupProbe:
            httpGet:
              path: /v1/health
              port: ntfy
      volumes:
        - name: ntfy-data
          persistentVolumeClaim:
            claimName: ntfy-pvc