apiVersion: apps/v1
kind: Deployment
metadata:
  name: jellystat
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: jellystat
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: jellystat
    helm.sh/chart: jellystat-5.0.1
  namespace: jellystat
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: jellystat
      app.kubernetes.io/instance: jellystat
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: jellystat
        app.kubernetes.io/name: jellystat
    spec:
      enableServiceLinks: false
      serviceAccountName: jellystat
      automountServiceAccountToken: false
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - env:
            - name: TZ
              value: America/Chicago
            - name: JWT_SECRET
              valueFrom:
                secretKeyRef:
                  key: secret-key
                  name: jellystat-config
            - name: JS_USER
              valueFrom:
                secretKeyRef:
                  key: user
                  name: jellystat-config
            - name: JS_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: jellystat-config
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  key: username
                  name: jellystat-postgresql-18-cluster-app
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: jellystat-postgresql-18-cluster-app
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  key: dbname
                  name: jellystat-postgresql-18-cluster-app
            - name: POSTGRES_IP
              valueFrom:
                secretKeyRef:
                  key: host
                  name: jellystat-postgresql-18-cluster-app
            - name: POSTGRES_PORT
              valueFrom:
                secretKeyRef:
                  key: port
                  name: jellystat-postgresql-18-cluster-app
          image: ghcr.io/cyfershepard/jellystat:1.1.10@sha256:bb7ebe42424dedeff52d8da4130232d67e3fdd6dc2dd4a66091e32ddd835ea42
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 400Mi
          volumeMounts:
            - mountPath: /app/backend/backup-data
              name: data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: jellystat-data
