---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: &app gotify
  namespace: monitoring
  labels:
    app.kubernetes.io/name: *app
    app.kubernetes.io/instance: *app
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: *app
      app.kubernetes.io/instance: *app
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        configmap.reloader.stakater.com/reload: *app
      labels:
        app.kubernetes.io/name: *app
        app.kubernetes.io/instance: *app
    spec:
      containers:
        - name: *app
          image: ghcr.io/gotify/server:2.1.4
          imagePullPolicy: IfNotPresent
          env:
            - name: TZ
              value: "${TIMEZONE}"
          envFrom:
            - secretRef:
                name: *app
          ports:
            - name: &port http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /health
              port: *port
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /health
              port: *port
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 3
          startupProbe:
            httpGet:
              path: /health
              port: *port
            failureThreshold: 30
            periodSeconds: 10
          resources:
            requests:
              cpu: 10m
              memory: 50Mi
            limits:
              cpu: 100m
              memory: 200Mi
          volumeMounts:
            - mountPath: /app/data
              name: config
      volumes:
        - name: config
          persistentVolumeClaim:
            claimName: gotify-config-v1
