---
# yaml-language-server: $schema=./values.schema.json

# -- Global parameters for the chart
# Used to configure GPU support and other global settings
global:
  # -- Enable GPU-specific settings (like CUDA paths and GPU resources)
  gpuEnabled: false

controllers:
  main:
    strategy: Recreate

    containers:
      main:
        image:
          # -- Image repository to pull
          repository: libretranslate/libretranslate
          # -- Image tag to pull (use vX.X.X-cuda for GPU builds)
          tag: v1.9.6
          # -- Image pull policy (Always, IfNotPresent, Never)
          pullPolicy: Always

        env:
          # -- Set to "1" to update language models on startup
          LT_UPDATE_MODELS: "1"
          # -- Set to "1" to enable API key usage for authentication
          LT_API_KEYS: "1"

        probes:
          liveness:
            enabled: true
            custom: true
            spec:
              httpGet:
                path: /
                port: http
          readiness:
            enabled: true
            custom: true
            spec:
              httpGet:
                path: /
                port: http

        resources:
          # -- Resource requests for the main container
          requests:
            cpu: 100m
            memory: 128Mi
          # -- Resource limits for the main container
          limits:
            cpu: 500m
            memory: 512Mi

# -- Service configuration to expose the application internally in the cluster
service:
  main:
    controller: main
    ports:
      http:
        # -- External service port
        port: 80
        # -- Internal container target port
        targetPort: 5000
        # -- Protocol to use (TCP/UDP)
        protocol: TCP

# -- Ingress configuration for external access to the service
ingress:
  main:
    # -- Enable or disable ingress
    enabled: false
    hosts:
      - host: chart-example.local
        paths:
          - path: /
            pathType: Prefix
            service:
              identifier: main
              port: http
    tls:
      - hosts:
          - chart-example.local
        # -- Secret containing TLS certificate for the ingress
        secretName: tls-chart-example-local

# -- Gateway API HTTPRoute, mirroring the Ingress above. Disabled by default:
# pick either Ingress or HTTPRoute, not both. Requires the Gateway API CRDs and
# an existing Gateway in the cluster.
route:
  main:
    # -- Enable the HTTPRoute. Mutually exclusive with `ingress.main.enabled`.
    enabled: false
    # -- Route kind. HTTPRoute, GRPCRoute, TCPRoute, TLSRoute or UDPRoute.
    kind: HTTPRoute
    # -- Gateways this route attaches to. `namespace` is required on common 3.x.
    parentRefs:
      - name: gateway
        namespace: gateway-system
        # -- Listener name on the Gateway. Optional.
        # sectionName: https
    # -- Hostnames served by this route.
    hostnames:
      - chart-example.local
    # -- Routing rules. `name` resolves to a Service identifier defined above.
    rules:
      - matches:
          - path:
              type: PathPrefix
              value: /
        backendRefs:
          - name: main

# -- Persistence volumes configuration for different data types
persistence:
  api-keys:
    # -- Enable persistence for API keys database
    enabled: false
    accessMode: ReadWriteOnce
    size: 10Mi
    annotations: {}
    globalMounts:
      - path: /app/db

  cache:
    # -- Enable temporary cache storage
    enabled: true
    type: emptyDir
    globalMounts:
      - path: /home/libretranslate/.local/cache

  db:
    # -- Enable database storage for application data
    enabled: false
    accessMode: ReadWriteOnce
    size: 1Gi
    annotations: {}
    globalMounts:
      - path: /home/libretranslate/.local/db

  share:
    # -- Enable persistent shared storage for translation models and shared assets
    enabled: true
    accessMode: ReadWriteOnce
    size: 20Gi
    annotations: {}
    globalMounts:
      - path: /home/libretranslate/.local/share

  files-translate:
    # -- Temporary storage for uploaded translation files
    enabled: true
    type: emptyDir
    globalMounts:
      - path: /tmp/libretranslate-files-translate

# -- Define additional volumes if needed
additionalVolumes: []

# -- Define additional volumeMounts if needed
additionalVolumeMounts: []

# -- Node selector for pod assignment
nodeSelector: {}

# -- Tolerations for pod assignment to specific nodes
tolerations: []

# -- Affinity rules to control pod assignment based on node labels
affinity: {}
