---
# 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: searxng
spec:
  interval: 30m
  chart:
    spec:
      chart: app-template
      version: 3.5.1
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      retries: 3
      strategy: rollback
  values:
    controllers:
      searxng:
        annotations:
          reloader.stakater.com/auto: "true"
        containers:
          app:
            image:
              repository: docker.io/searxng/searxng
              tag: 2024.7.7-ef103ba80
            envFrom:
              - secretRef:
                  name: searxng-secret
            env:
              TZ: America/Chicago
              SEARXNG_BASE_URL: https://search.jahanson.tech
              SEARXNG_URL: https://search.jahanson.tech
              SEARXNG_PORT: &port 8080
            probes:
              liveness: &probes
                enabled: true
                custom: true
                spec:
                  httpGet:
                    path: /stats
                    port: *port
                  initialDelaySeconds: 0
                  periodSeconds: 10
                  timeoutSeconds: 1
                  failureThreshold: 3
              readiness: *probes
              startup:
                enabled: false
            securityContext:
              allowPrivilegeEscalation: false
              readOnlyRootFilesystem: true
              capabilities:
                drop:
                  - ALL
                add:
                  - CHOWN
                  - SETGID
                  - SETUID
                  - DAC_OVERRIDE
            resources:
              requests:
                cpu: 10m
              limits:
                memory: 3Gi
    service:
      app:
        controller: searxng
        ports:
          http:
            port: *port
    ingress:
      app:
        enabled: true
        className: internal-nginx
        hosts:
          - host: &host "search.jahanson.tech"
            paths:
              - path: /
                service:
                  identifier: app
                  port: http
        tls:
          - hosts:
              - *host
    persistence:
      config:
        type: configMap
        name: searxng-configmap
        advancedMounts:
          searxng:
            app:
              - path: /etc/searxng/settings.yml
                subPath: settings.yml
                readOnly: true
              - path: /etc/searxng/limiter.toml
                subPath: limiter.toml
                readOnly: true
      tmp:
        type: emptyDir
        advancedMounts:
          searxng:
            app:
              - path: /etc/searxng