---
apiVersion: v1
kind: ConfigMap
metadata:
  name: envoy
  namespace: default
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:
            protocol: TCP
            address: 0.0.0.0
            port_value: 8080
        filter_chains:
        - filters:
          - name: envoy.filters.network.http_connection_manager
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
              stat_prefix: ingress_http
              route_config:
                name: local_route
                virtual_hosts:

                - name: local_service
                  domains:
                  - "*"
                  
                  routes:
                  - match:
                      prefix: "/*"
                    route:
                      cluster: service1
                      retry_policy:
                        retry_on: "5xx"
                        num_retries: 10
                        per_try_timeout: 2s
                  # ---

              http_filters:
              - name: envoy.filters.http.router
              http2_protocol_options:
                allow_connect: true
              upgrade_configs:
              - upgrade_type: CONNECT
      
      clusters:
      - name: service1
        connect_timeout: 0.25s
        type: STRICT_DNS
        lb_policy: ROUND_ROBIN
        circuit_breakers:
          thresholds:
            max_connections: 1
            max_pending_requests: 1
            max_requests: 1
            max_retries: 2
        load_assignment:
          cluster_name: service1
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: envoy.projectcontour
                    port_value: 80