apiVersion: v1
kind: ConfigMap
metadata:
  name: server-sidecar-envoy
data:
  envoy.yaml: |
    admin:
      access_log_path: /tmp/admin_access.log
      address:
        socket_address: { address: 0.0.0.0, port_value: 8001 }
    static_resources:
      listeners:
        - name: listener_grpc
          address:
            socket_address: { address: 0.0.0.0, port_value: 5001 }
          filter_chains:
            - filters:
                - name: envoy.http_connection_manager
                  config:
                    stat_prefix: ingress_http
                    codec_type: AUTO
                    route_config:
                      name: local_route
                      virtual_hosts:
                        - name: service
                          domains: ["*"]
                          routes:
                            - match: { prefix: "/" }
                              route: { cluster: backend_grpc }
                    http_filters:
                      - name: envoy.router
      clusters:
        - name: backend_grpc
          connect_timeout: 0.25s
          type: STATIC
          lb_policy: ROUND_ROBIN
          http2_protocol_options: {}
          health_checks:
            - timeout: 5s
              interval: 10s
              unhealthy_threshold: 2
              healthy_threshold: 2
              tcp_health_check: {}
          load_assignment:
            cluster_name: backend_grpc
            endpoints:
              lb_endpoints:
                - endpoint:
                    address:
                      socket_address:
                        address: 127.0.0.1
                        port_value: 50051
