apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: trino
  namespace: trino
spec:
  interval: 5m
  timeout: 20m
  values:
    nameOverride: trino
    coordinatorNameOverride: trino-coordinator
    workerNameOverride: trino-worker
    gateway:
      enabled: false
    virtualService:
      enabled: false
    server:
      workers: 1
      log:
        trino:
          level: INFO
      config:
        authenticationType: ""
        query:
          maxMemory: 20GB
      autoscaling:
        enabled: false
    additionalLogProperties: []
    auth:
      passwordAuthSecret: ""
    env:
      - name: PROD_PG_RO_PASSWORD
        valueFrom:
          secretKeyRef:
            name: postgres-secret
            key: postgres_ro_password
    catalogs:
      sarex_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/sarex_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      flows_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/flows_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      issues_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/issues_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      workspaces_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/workspaces_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      resources_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/resources_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      pm_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/pm_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      eav_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/eav_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      inspections_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/inspections_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      documentations_db: |
        connector.name=postgresql
        connection-url=jdbc:postgresql://sarex-vpsql-01.xc.wb.ru:5432/documentations_db?sslmode=disable
        connection-user=readonly
        connection-password=${ENV:PROD_PG_RO_PASSWORD}
        postgresql.array-mapping=AS_JSON
      clickhouse_db: |
        connector.name=tpch
        tpch.splits-per-node=4
      hive: |
        connector.name=tpch
        tpch.splits-per-node=4
    coordinator:
      jvm:
        maxHeapSize: 6G
      config:
        memory:
          heapHeadroomPerNode: 1GB
        query:
          maxMemoryPerNode: 4GB
      resources:
        requests:
          cpu: 500m
          memory: 6Gi
        limits:
          memory: 8Gi
      nodeSelector:
        dedicated: processing-light
      tolerations:
        - key: dedicated
          operator: Equal
          value: processing-light
          effect: NoSchedule
    worker:
      jvm:
        maxHeapSize: 24G
      config:
        memory:
          heapHeadroomPerNode: 4GB
        query:
          maxMemoryPerNode: 20GB
      resources:
        requests:
          cpu: 500m
          memory: 24Gi
        limits:
          memory: 32Gi
      nodeSelector:
        dedicated: processing-light
      tolerations:
        - key: dedicated
          operator: Equal
          value: processing-light
          effect: NoSchedule
