apiVersion: v1
kind: ConfigMap
metadata:
  name: envoy-config
data:
  envoy.yaml: |
    admin:
      access_log_path: /tmp/admin_access.log
      address:
        socket_address: { address: 0.0.0.0, port_value: 9901 }
    static_resources:
      listeners:
        - name: listener_0
          address:
            socket_address: { address: 0.0.0.0, port_value: 10000 }
          filter_chains:
            - filters:
                - name: envoy.http_connection_manager
                  typed_config:
                    "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
                    stat_prefix: ingress_http
                    codec_type: AUTO
                    upgrade_configs:
                      - upgrade_type: "websocket"
                        enabled: true
                    route_config:
                      name: local_route
                      virtual_hosts:
                        - name: tracks_service
                          domains: ["*"]
                          routes:
                            - match: { prefix: "/api/" }
                              route:
                                timeout: 900s
                                cluster: backend
                            - match: { prefix: "/" }
                              route:
                                cluster: frontend
                    http_filters:
                    - name: envoy.router
      clusters:
        - name: frontend
          connect_timeout: 0.25s
          type: LOGICAL_DNS
          lb_policy: ROUND_ROBIN
          hosts:
            - socket_address:
                address: frontend
                port_value: 5001
        - name: backend
          connect_timeout: 0.25s
          type: LOGICAL_DNS
          lb_policy: ROUND_ROBIN
          hosts:
            - socket_address:
                address: backend
                port_value: 6005
