static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 80
    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
          codec_type: AUTO
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains:
              - "*"
              routes:
              - match:
                  prefix: "/version-to-metadata"
                route:
                  cluster: service
                typed_per_filter_config:
                  envoy.filters.http.json_to_metadata:
                    "@type": type.googleapis.com/envoy.extensions.filters.http.json_to_metadata.v3.JsonToMetadata
                    request_rules:
                      rules:
                      - selectors:
                        - key: version
                        on_present:
                          metadata_namespace: envoy.lb
                          key: version
              - match:
                  prefix: "/"
                route:
                  cluster: some_service
          http_filters:
          - name: envoy.filters.http.json_to_metadata
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.json_to_metadata.v3.JsonToMetadata
              request_rules:
                rules:
                - selectors:
                  - key: version
                  on_present:
                    metadata_namespace: envoy.lb
                    key: version
                  on_missing:
                    metadata_namespace: envoy.lb
                    key: default
                    value: 'true'
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: service
    type: STATIC
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: service
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 10001
          metadata:
            filter_metadata:
              envoy.lb:
                version: '1.0'
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 10002
          metadata:
            filter_metadata:
              envoy.lb:
                version: '1.1'
  - name: some_service
    type: STATIC
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: some_service
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 10003
