# Jinja2 template for Envoy configuration
admin:
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9901

static_resources:
  listeners:
    # Listener for ytdlp-ops Thrift traffic
    - name: ytdlp_ops_listener
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 9080
      filter_chains:
        - filters:
            - name: envoy.filters.network.thrift_proxy
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.thrift_proxy.v3.ThriftProxy
                stat_prefix: thrift_ingress
                transport: FRAMED
                protocol: BINARY
                route_config:
                  name: local_route
                  routes:
                    - match:
                        method_name: ""
                      route:
                        cluster: ytdlp_ops_cluster

  clusters:
    # Cluster for the ytdlp-ops workers
    - name: ytdlp_ops_cluster
      connect_timeout: 5s
      type: STRICT_DNS
      lb_policy: ROUND_ROBIN
      health_checks:
        - timeout: 1s
          interval: 5s
          unhealthy_threshold: 3
          healthy_threshold: 2
          tcp_health_check: {}
      load_assignment:
        cluster_name: ytdlp_ops_cluster
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: ytdlp-ops-server
                      port_value: 9090
