---
apiVersion: v1
kind: ConfigMap
metadata:
  name: xds
data:
  listeners: |
    - name: foo
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 10001
      filter_chains:
        - filters:
          - name: envoy.tcp_proxy
            typed_config:
              '@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
              cluster: foo
              stat_prefix: foo
          - name: envoy.filters.http.health_check
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
              pass_through_mode: true
              cache_time: 1s
              headers:
              - name: :path
                exact_match: /health/
    - name: bar
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 10002
      filter_chains:
        - filters:
          - name: envoy.tcp_proxy
            typed_config:
              '@type': type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy
              cluster: bar
              stat_prefix: bar
    - name: qux
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 10002
      filter_chains:
        - filters:
          - name: envoy.tcp_proxy
            typed_config:
              '@type': type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy
              cluster: qux 
              stat_prefix: qux

  clusters: |
    - name: foo
      type: EDS
      connect_timeout: 0.25s
      eds_cluster_config:
        service_name: default/foo
        eds_config:
          api_config_source:
            api_type: REST
            cluster_names: [xds_cluster]
            refresh_delay: 1s
    - name: bar
      type: EDS
      connect_timeout: 0.25s
      eds_cluster_config:
        service_name: default/bar
        eds_config:
          api_config_source:
            api_type: REST
            cluster_names: [xds_cluster]
            refresh_delay: 1s
    - name: baz
      type: STATIC
      connect_timeout: 0.25s
      load_assignment:
        cluster_name: baz
        endpoints:
        - lb_endpoints:
          - endpoint:
              address:
                socket_address:
                  address: 127.0.0.1
                  port_value: 8888
    - name: qux
      type: EDS
      connect_timeout: 0.25s
      eds_cluster_config:
        service_name: quxns/qux
        eds_config:
          api_config_source:
            api_type: REST
            cluster_names: [xds_cluster]
            refresh_delay: 1s

  assignments: |
    by-cluster:
      foo:
        listeners:
          - foo
        clusters:
          - foo
      bar:
        listeners:
          - bar
        clusters:
          - bar
      qux:
        listeners:
          - qux
        clusters:
          - qux
      baz:
        clusters:
          - bar
          - baz
    by-node-id:
      foo:
        listeners:
          - foo
        clusters:
          - foo
      bar:
        listeners:
          - bar
        clusters:
          - bar
      qux:
        listeners:
          - qux 
        clusters:
          - qux
