apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: firefly-iii-res-upload-claim
  namespace: firefly-res
  labels:
    app: firefly-iii-res
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ""
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
  name: firefly-iii-res
  namespace: firefly-res
  labels:
    app: firefly-iii-res
spec:
  type: NodePort
  ports:
    - name: firefly-res
      port: 8080
      nodePort: 30580
      targetPort: firefly-iii-res
  selector:
    app: firefly-iii-res
    tier: frontend
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: firefly-iii-res
  namespace: firefly-res
  labels:
    app: firefly-iii-res
spec:
  selector:
    matchLabels:
      app: firefly-iii-res
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: firefly-iii-res
        tier: frontend
    spec:
      containers:
      - image: fireflyiii/core:latest
        name: firefly-iii-res
        env:
        - name: APP_ENV
          value: local
        - name: APP_KEY
          valueFrom:
            secretKeyRef:
              name: firefly-iii-res-secrets
              key: app_key
        - name: DB_HOST
          value: firefly-iii-res-mysql
        - name: DB_CONNECTION
          value: mysql
        - name: DB_DATABASE
          value: "firefly-resiii"
        - name: DB_USERNAME
          value: "root"
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: firefly-iii-res-secrets
              key: db_password
        - name: TRUSTED_PROXIES
          value: "**"
        - name: MAIL_MAILER
          value: smtp
        - name: MAIL_HOST
          value: "smtp.mail.yahoo.com"
        - name: MAIL_PORT 
          value: "465"
        - name: MAIL_FROM 
          value: "celestino_rey@ymail.com"
        - name: MAIL_USERNAME 
          valueFrom:
            secretKeyRef:
              name: firefly-iii-res-secrets
              key: mail_user
        - name: MAIL_PASSWORD 
          valueFrom:
            secretKeyRef:
              name: firefly-iii-res-secrets
              key: mail_password
        - name: MAIL_ENCRYPTION 
          value: "ssl"
        ports:
        - containerPort: 8080
          name: firefly-iii-res
        volumeMounts:
        - mountPath: "/var/www/html/firefly-iii-res/storage/upload"
          name: firefly-iii-res-upload 
        imagePullPolicy: Always
      volumes:
        - name: firefly-iii-res-upload
          persistentVolumeClaim:
            claimName: firefly-iii-res-upload-claim
