apiVersion: apps/v1
kind: Deployment
metadata:
  name: grimmory
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: grimmory
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grimmory
    helm.sh/chart: grimmory-5.0.1
  namespace: grimmory
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: grimmory
      app.kubernetes.io/instance: grimmory
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: grimmory
        app.kubernetes.io/name: grimmory
    spec:
      enableServiceLinks: false
      serviceAccountName: grimmory
      automountServiceAccountToken: false
      securityContext:
        fsGroup: 1000
        fsGroupChangePolicy: OnRootMismatch
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - env:
            - name: TZ
              value: America/Chicago
            - name: USER_ID
              value: "1000"
            - name: GROUP_ID
              value: "1000"
            - name: DATABASE_URL
              value: jdbc:mariadb://grimmory-mariadb-cluster-primary.grimmory:3306/booklore
            - name: DATABASE_USERNAME
              value: grimmory
            - name: DATABASE_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: grimmory-database-secret
            - name: GRIMMORY_PORT
              value: "6060"
            - name: SWAGGER_ENABLED
              value: "false"
          image: ghcr.io/grimmory-tools/grimmory:v3.1.0@sha256:c83dcb59975c9a680ecdf84d60e7e5c9b05200818bab8794f4d84a7e008a549a
          livenessProbe:
            failureThreshold: 5
            httpGet:
              path: /api/v1/healthcheck
              port: 6060
            periodSeconds: 10
            timeoutSeconds: 5
          name: main
          readinessProbe:
            failureThreshold: 5
            httpGet:
              path: /api/v1/healthcheck
              port: 6060
            periodSeconds: 10
            timeoutSeconds: 5
          resources:
            requests:
              cpu: 10m
              memory: 1Gi
          startupProbe:
            failureThreshold: 30
            httpGet:
              path: /api/v1/healthcheck
              port: 6060
            periodSeconds: 60
            timeoutSeconds: 5
          volumeMounts:
            - mountPath: /bookdrop
              name: books-import
            - mountPath: /app/data
              name: config
            - mountPath: /data
              name: data
            - mountPath: /bookdrop/ingest
              name: ingest
      volumes:
        - emptyDir: {}
          name: books-import
        - name: config
          persistentVolumeClaim:
            claimName: grimmory-config
        - name: data
          persistentVolumeClaim:
            claimName: grimmory-books-nfs-storage
        - name: ingest
          persistentVolumeClaim:
            claimName: grimmory-books-import-nfs-storage
