---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: &app open-webui
spec:
  interval: 30m
  chart:
    spec:
      chart: app-template
      version: 3.5.1
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
  dependsOn:
    - name: ollama
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      retries: 3
      strategy: rollback
  values:
    controllers:
      open-webui:
        annotations:
          reloader.stakater.com/auto: "true"
        containers:
          app:
            image:
              repository: ghcr.io/open-webui/open-webui
              tag: 0.3.32
            env:
              - name: OLLAMA_BASE_URL
                value: http://ollama.ai.svc.cluster.local:11434
              - name: ENABLE_RAG_WEB_SEARCH
                value: true
              - name: RAG_WEB_SEARCH_ENGINE
                value: searxng
              - name: SEARXNG_QUERY_URL
                value: http://searxng.default.svc.cluster.local:8080/search?q=<query>
            resources:
              requests:
                cpu: 500m
                memory: 2Gi
              limits:
                memory: 2Gi
    service:
      app:
        controller: open-webui
        ports:
          http:
            port: 8080
    ingress:
      app:
        enabled: true
        className: internal-nginx
        hosts:
          - host: &host "chat.jahanson.tech"
            paths:
              - path: /
                service:
                  identifier: app
                  port: http
        tls:
          - hosts:
              - *host
    persistence:
      config:
        enabled: true
        existingClaim: *app
        globalMounts:
          - path: /app/backend/data