---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: firefly-iii
  namespace: default
  labels:
    app.kubernetes.io/instance: firefly-iii
    app.kubernetes.io/name: firefly-iii
spec:
  selector:
    matchLabels:
      app.kubernetes.io/instance: firefly-iii
      app.kubernetes.io/name: firefly-iii
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: firefly-iii
        app.kubernetes.io/name: firefly-iii
    spec:
      containers:
      - name: firefly-iii
        image: fireflyiii/core:version-5.7.5
        imagePullPolicy: IfNotPresent
        env:
        - name: APP_ENV
          value: "local"
        - name: APP_KEY
          valueFrom:
            secretKeyRef:
              name: firefly-iii-secrets
              key: app_key
        - name: DB_HOST
          value: homelab-pgsql.database.svc.cluster.local
        - name: DB_CONNECTION
          value: pgsql
        - name: DB_DATABASE
          value: "firefly"
        - name: DB_USERNAME
          value: "firefly"
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: firefly-iii-secrets
              key: db_password
        - name: TRUSTED_PROXIES
          value: "10.42.0.0/16,10.43.0.0/16,172.16.0.0/12,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,104.16.0.0/13,104.24.0.0/14,108.162.192.0/18,131.0.72.0/22,141.101.64.0/18,162.158.0.0/15,172.64.0.0/13,173.245.48.0/20,188.114.96.0/20,190.93.240.0/20,197.234.240.0/22,198.41.128.0/17,2400:cb00::/32,2606:4700::/32,2803:f800::/32,2405:b500::/32,2405:8100::/32,2a06:98c0::/29,2c0f:f248::/32"
        ports:
        - containerPort: 8080
          name: firefly-iii
        volumeMounts:
        - mountPath: "/var/www/html/firefly-iii/storage/upload"
          name: firefly-iii-data
        resources:
          requests:
            cpu: 50m
            memory: 512Mi
          limits:
            cpu: 900m
            memory: 1Gi
      volumes:
        - name: firefly-iii-data
          persistentVolumeClaim:
            claimName: firefly-iii-data