apiVersion: v1
kind: ConfigMap
metadata:
  name: flask-envoy
  namespace: default
data:
  envoy.yaml: >
    static_resources:
      listeners:
      - address:
          socket_address:
            address: 0.0.0.0
            port_value: 5001
        use_original_dst: true
        filter_chains:
        - filters:
          - name: envoy.http_connection_manager
            config:
              codec_type: auto
              generate_request_id: true
              access_log:
              - name: envoy.file_access_log
                config:
                  path: "/dev/stdout"
              tracing:
                operation_name: ingress
              stat_prefix: ingress_http
              route_config:
                name: flask_route
                virtual_hosts:
                - name: flask
                  domains:
                  - "*"
                  routes:
                  - match:
                      prefix: "/"
                    route:
                      cluster: flask
                    decorator:
                      operation: flask-envoy-ingress
              http_filters:
              - name: envoy.router
                config: {}
      # Upstream configuration
      # https://www.envoyproxy.io/docs/envoy/v1.10.0/api-v2/api/v2/cds.proto
      clusters:
      - name: flask
        connect_timeout: 0.250s
        type: static
        lb_policy: round_robin
        health_checks:
        - timeout: 5s
          interval: 10s
          unhealthy_threshold: 3
          healthy_threshold: 1
          tcp_health_check: {}
        hosts:
        - socket_address:
            address: 127.0.0.1
            port_value: 8000
    admin:
      access_log_path: "/var/log/admin-access.log"
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 8001