apiVersion: v1
kind: ConfigMap
metadata:
  name: tiflash-columnar-readnode-config
data:
  config_templ.toml: |
    default_profile = "default"
    display_name = "TiFlash"
    https_port = 8123
    interserver_http_port = 9009
    listen_host = "0.0.0.0"
    mark_cache_size = 5368709120
    path = "/data0"
    path_realtime_mode = false
    tcp_port_secure = 9000
    tmp_path = "/data0/tmp"

    [flash]
      disaggregated_mode = "tiflash_compute"
      service_addr = "0.0.0.0:3930"
      tidb_status_addr = "serverless-cluster-tidb.tidb-serverless.svc:10080"
      use_columnar = true
      use_autoscaler = false
      [flash.flash_cluster]
        cluster_manager_path = "/tiflash/flash_cluster_manager"
        log = "/data0/logs/flash_cluster_manager.log"
        master_ttl = 60
        refresh_interval = 20
        update_rule_interval = 10
      [flash.proxy]
        config = "/data0/proxy.toml"
        engine-addr = "tiflash-columnar-readnode-POD_NUM.tiflash-columnar-readnode-peer.tidb-serverless.svc:3930"

    [logger]
      count = 10
      errorlog = "/data0/logs/error.log"
      level = "{{LOG_LEVEL}}"
      log = "/data0/logs/server.log"
      size = "2000M"

    [profiles]
      [profiles.default]
        max_memory_usage = 10000000000

    [raft]
      pd_addr = "serverless-cluster-pd.tidb-serverless.svc:2379"

    [security]
      ca_path = "/server-cert/ca.crt"
      cert_path = "/server-cert/tls.crt"
      key_path = "/server-cert/tls.key"

    [status]
      metrics_port = 8234

    [storage]
      api_version = 2
      [storage.main]
        dir = ["/data0/db"]
      [storage.s3]
        bucket = "{{TIFLASH_S3_BUCKET}}"
        endpoint = "{{TIFLASH_S3_ENDPOINT}}"
        root = "{{TIFLASH_S3_ROOT}}"
  proxy_templ.toml: |
    log-level = "{{LOG_LEVEL}}"

    [raft-engine]
      enable = false

    [security]
      ca-path = "/server-cert/ca.crt"
      cert-path = "/server-cert/tls.crt"
      key-path = "/server-cert/tls.key"

    [server]
      advertise-status-addr = "tiflash-columnar-readnode-POD_NUM.tiflash-columnar-readnode-peer.tidb-serverless.svc:20292"
      engine-addr = "tiflash-columnar-readnode-POD_NUM.tiflash-columnar-readnode-peer.tidb-serverless.svc:3930"
      status-addr = "0.0.0.0:20292"

    [storage]
      data-dir = "/data0/flash"
      reserve-space = "0"

    [vector-index]
      cache-cap = "10%"
