Skip to content

extension: cluster router#441

Open
AntonKanug wants to merge 5 commits into
tetratelabs:mainfrom
AntonKanug:antonk/cluster-router
Open

extension: cluster router#441
AntonKanug wants to merge 5 commits into
tetratelabs:mainfrom
AntonKanug:antonk/cluster-router

Conversation

@AntonKanug

@AntonKanug AntonKanug commented May 22, 2026

Copy link
Copy Markdown
Contributor

@AntonKanug AntonKanug requested review from nacx and wbpcode as code owners May 22, 2026 00:06
@AntonKanug AntonKanug marked this pull request as draft May 22, 2026 00:06
@AntonKanug

AntonKanug commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Test:

envoy 1 -> envoy 2 -> envoy 3

envoy 1:

10001 listener
  {
                            "envoy_id": "envoy1",
                            "envoy_admin_url": "http://127.0.0.1:9911",
                            "advertise_listen": "0.0.0.0:7001",
                            "peers": [
                              {
                                "id": "envoy2",
                                "endpoint": "http://127.0.0.1:7002",
                                "local_cluster": "peer_envoy2",
                                "weight": 10
                              }
                            ],
                            "poll_interval": "2s",
                            "stale_after": "30s"
}

envoy 2:

envoy 1 connects via 10002 of envoy2
{
                            "envoy_id": "envoy2",
                            "envoy_admin_url": "http://127.0.0.1:9912",
                            "advertise_listen": "0.0.0.0:7002",
                            "peers": [
                              {
                                "id": "envoy3",
                                "endpoint": "http://127.0.0.1:7003",
                                "local_cluster": "peer_envoy3",
                                "weight": 10
                              }
                            ],
                            "poll_interval": "2s",
                            "stale_after": "30s"
}

envoy 3:

envoy 2 connects via 10003 of envoy3
 {
                            "envoy_id": "envoy3",
                            "envoy_admin_url": "http://127.0.0.1:9913",
                            "advertise_listen": "0.0.0.0:7003",
                            "peers": [],
                            "poll_interval": "2s",
                            "stale_after": "30s"
}

has cluster:
    - name: remote_svc
      connect_timeout: 1s
      type: STATIC
      lb_policy: ROUND_ROBIN
      metadata:
        filter_metadata:
          boe.cluster_router:
            role: terminal
      load_assignment:
        cluster_name: remote_svc
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address: { address: 127.0.0.1, port_value: 8080 }

test:

curl -i -H 'x-target-cluster: remote_svc' http://127.0.0.1:10001/get
HTTP/1.1 200 OK
server: envoy
date: Fri, 22 May 2026 00:07:30 GMT
content-type: application/json
content-length: 315
access-control-allow-origin: *
access-control-allow-credentials: true
x-envoy-upstream-service-time: 6

{
  "args": {}, 
  "headers": {
    "Accept": "*/*", 
    "Host": "127.0.0.1:10001", 
    "User-Agent": "curl/8.7.1", 
    "X-Boe-Next-Hop": "remote_svc", 
    "X-Envoy-Expected-Rq-Timeout-Ms": "5000", 
    "X-Target-Cluster": "remote_svc"
  }, 
  "origin": "192.168.65.1", 
  "url": "http://127.0.0.1:10001/get"
}

antonk@antonk881-mac cluster-router-test % curl -s 'http://127.0.0.1:7001/advertisements?peer=tester' | jq .
{
  "envoy_id": "envoy1",
  "routes": [
    {
      "target_cluster": "remote_svc",
      "next_hop_local_cluster": "peer_envoy2",
      "distance": 20,
      "as_path": [
        "envoy2",
        "envoy3"
      ]
    }
  ]
}
antonk@antonk881-mac cluster-router-test %  curl -s 'http://127.0.0.1:7002/advertisements?peer=tester' | jq .
{
  "envoy_id": "envoy2",
  "routes": [
    {
      "target_cluster": "remote_svc",
      "next_hop_local_cluster": "peer_envoy3",
      "distance": 10,
      "as_path": [
        "envoy3"
      ]
    }
  ]
}
antonk@antonk881-mac cluster-router-test % curl -s 'http://127.0.0.1:7003/advertisements?peer=tester' | jq .
{
  "envoy_id": "envoy3",
  "routes": [
    {
      "target_cluster": "remote_svc",
      "next_hop_local_cluster": "remote_svc",
      "distance": 0,
      "as_path": null
    }
  ]
}
antonk@antonk881-mac cluster-router-test % 

@AntonKanug AntonKanug force-pushed the antonk/cluster-router branch 6 times, most recently from 3a754ea to 07e1c7f Compare May 22, 2026 17:27
@AntonKanug AntonKanug marked this pull request as ready for review May 22, 2026 17:37
@AntonKanug AntonKanug force-pushed the antonk/cluster-router branch from 61f8957 to 12c2f36 Compare June 16, 2026 18:44
Anton Kanugalawattage added 5 commits June 16, 2026 14:49
Signed-off-by: Anton Kanugalawattage <antonk@palantir.com>
Signed-off-by: Anton Kanugalawattage <antonk@palantir.com>
cov
Signed-off-by: Anton Kanugalawattage <antonk@palantir.com>
fix
Signed-off-by: Anton Kanugalawattage <antonk@palantir.com>
Signed-off-by: Anton Kanugalawattage <antonk@palantir.com>
@AntonKanug AntonKanug force-pushed the antonk/cluster-router branch from 12c2f36 to 03b6bce Compare June 16, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant