apiVersion: apps/v1
kind: Deployment
metadata:
  name: karakeep
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: karakeep
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: karakeep
    helm.sh/chart: karakeep-4.6.2
  namespace: karakeep
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: karakeep
      app.kubernetes.io/instance: karakeep
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: karakeep
        app.kubernetes.io/name: karakeep
    spec:
      enableServiceLinks: false
      serviceAccountName: default
      automountServiceAccountToken: true
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - args:
            - --no-sandbox
            - --disable-gpu
            - --disable-dev-shm-usage
            - --remote-debugging-address=0.0.0.0
            - --remote-debugging-port=9222
            - --hide-scrollbars
          image: gcr.io/zenika-hub/alpine-chrome:124
          imagePullPolicy: IfNotPresent
          name: chrome
          resources:
            requests:
              cpu: 10m
              memory: 128Mi
        - env:
            - name: DATA_DIR
              value: /data
            - name: DB_WAL_MODE
              value: "true"
            - name: NEXTAUTH_URL
              value: https://karakeep.alexlebens.dev/
            - name: NEXTAUTH_SECRET
              valueFrom:
                secretKeyRef:
                  key: key
                  name: karakeep-key-secret
            - name: PROMETHEUS_AUTH_TOKEN
              valueFrom:
                secretKeyRef:
                  key: prometheus-token
                  name: karakeep-key-secret
            - name: ASSET_STORE_S3_ENDPOINT
              value: http://rook-ceph-rgw-ceph-objectstore.rook-ceph.svc:80
            - name: ASSET_STORE_S3_REGION
              value: us-east-1
            - name: ASSET_STORE_S3_BUCKET
              valueFrom:
                configMapKeyRef:
                  key: BUCKET_NAME
                  name: ceph-bucket-karakeep
            - name: ASSET_STORE_S3_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  key: AWS_ACCESS_KEY_ID
                  name: ceph-bucket-karakeep
            - name: ASSET_STORE_S3_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  key: AWS_SECRET_ACCESS_KEY
                  name: ceph-bucket-karakeep
            - name: ASSET_STORE_S3_FORCE_PATH_STYLE
              value: "true"
            - name: MEILI_ADDR
              value: http://karakeep-meilisearch.karakeep:7700
            - name: MEILI_MASTER_KEY
              valueFrom:
                secretKeyRef:
                  key: MEILI_MASTER_KEY
                  name: karakeep-meilisearch-master-key-secret
            - name: BROWSER_WEB_URL
              value: http://karakeep.karakeep:9222
            - name: DISABLE_SIGNUPS
              value: "false"
            - name: OAUTH_PROVIDER_NAME
              value: Authentik
            - name: OAUTH_WELLKNOWN_URL
              value: https://auth.alexlebens.dev/application/o/karakeep/.well-known/openid-configuration
            - name: OAUTH_SCOPE
              value: openid email profile
            - name: OAUTH_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  key: AUTHENTIK_CLIENT_ID
                  name: karakeep-oidc-secret
            - name: OAUTH_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  key: AUTHENTIK_CLIENT_SECRET
                  name: karakeep-oidc-secret
            - name: OLLAMA_BASE_URL
              value: http://ollama-server-3.ollama:11434
            - name: OLLAMA_KEEP_ALIVE
              value: 5m
            - name: INFERENCE_TEXT_MODEL
              value: gemma3:4b
            - name: INFERENCE_IMAGE_MODEL
              value: granite3.2-vision:2b
            - name: EMBEDDING_TEXT_MODEL
              value: mxbai-embed-large
            - name: INFERENCE_JOB_TIMEOUT_SEC
              value: "720"
          image: ghcr.io/karakeep-app/karakeep:0.30.0
          imagePullPolicy: IfNotPresent
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 256Mi
          volumeMounts:
            - mountPath: /data
              name: data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: karakeep
