{"id":18821633,"url":"https://github.com/octu0/example-envoy-xds","last_synced_at":"2025-04-14T00:32:42.637Z","repository":{"id":54753458,"uuid":"322343607","full_name":"octu0/example-envoy-xds","owner":"octu0","description":"Example implementation of envoy xDS v3 API","archived":false,"fork":false,"pushed_at":"2024-03-25T09:06:22.000Z","size":77,"stargazers_count":10,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T06:55:59.360Z","etag":null,"topics":["envoy","envoy-xds","envoyproxy","grpc","grpc-server","load-balancer","proxy-server","weighted-round-robin","xds","xds-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/octu0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-17T15:58:10.000Z","updated_at":"2024-03-26T17:37:26.000Z","dependencies_parsed_at":"2024-03-25T10:02:58.475Z","dependency_job_id":null,"html_url":"https://github.com/octu0/example-envoy-xds","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octu0%2Fexample-envoy-xds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octu0%2Fexample-envoy-xds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octu0%2Fexample-envoy-xds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octu0%2Fexample-envoy-xds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octu0","download_url":"https://codeload.github.com/octu0/example-envoy-xds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223612891,"owners_count":17173631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["envoy","envoy-xds","envoyproxy","grpc","grpc-server","load-balancer","proxy-server","weighted-round-robin","xds","xds-server"],"created_at":"2024-11-08T00:44:58.548Z","updated_at":"2024-11-08T00:44:59.521Z","avatar_url":"https://github.com/octu0.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `example-envoy-xds`\n\n[![Apache License](https://img.shields.io/github/license/octu0/example-envoy-xds)](https://github.com/octu0/example-envoy-xds/blob/master/LICENSE)\n[![GoDoc](https://godoc.org/github.com/octu0/example-envoy-xds?status.svg)](https://godoc.org/github.com/octu0/example-envoy-xds)\n[![Go Report Card](https://goreportcard.com/badge/github.com/octu0/example-envoy-xds)](https://goreportcard.com/report/github.com/octu0/example-envoy-xds)\n[![Releases](https://img.shields.io/github/v/release/octu0/example-envoy-xds)](https://github.com/octu0/example-envoy-xds/releases)\n\n`example-envoy-xds` is an example of implementation of [envoy](https://www.envoyproxy.io/) and [control-plane](https://github.com/envoyproxy/go-control-plane/) using [v3 xDS](https://www.envoyproxy.io/docs/envoy/v1.15.3/api-docs/xds_protocol) API.\n\nFeatures:\n- xDS (EDS/CDS/LDS/RDS/ALS)\n- Dynamic update of yaml files (using [fsnotify](github.com/fsnotify/fsnotify))\n- Access log storage using ALS\n- Configuration examples of various settings\n- Configuration of Weighted Round Robin LoadBalancer\n\n## Bootstrapping\n\nAs bootstrap, in [envoy/envoy.yaml](https://github.com/octu0/example-envoy-xds/blob/master/envoy/envoy.yaml), specify `example-envoy-xds` in `xds_cluster` and `als_cluster`  \nThis will allow xDS communication with grpc.\n\nFor general use, `envoy.yaml` is used as a template file and replaced by `sed` in [docker-entrypoint.sh](https://github.com/octu0/example-envoy-xds/blob/master/envoy/docker-entrypoint.sh).\n\n```yaml\nnode:\n  cluster: @ENVOY_XDS_CLUSTER@\n  id: @ENVOY_XDS_NODE_ID@\n  locality:\n    region: @ENVOY_XDS_LOCALITY_REGION@\n    zone: @ENVOY_XDS_LOCALITY_ZONE@\n\nadmin:\n  access_log_path: /dev/null\n  address:\n    socket_address: { protocol: TCP, address: @ENVOY_ADMIN_LISTEN_HOST@, port_value: @ENVOY_ADMIN_LISTEN_PORT@ }\n\ndynamic_resources:\n  lds_config:\n    resource_api_version: V3\n    api_config_source:\n      api_type: GRPC\n      transport_api_version: V3\n      grpc_services:\n      - envoy_grpc: { cluster_name: xds_cluster }\n      set_node_on_first_message_only: true\n  cds_config:\n    resource_api_version: V3\n    api_config_source:\n      api_type: GRPC\n      transport_api_version: V3\n      grpc_services:\n      - envoy_grpc: { cluster_name: xds_cluster }\n      set_node_on_first_message_only: true\n\nstatic_resources:\n  clusters:\n  - name: xds_cluster\n    connect_timeout: 1s\n    type: STATIC\n    lb_policy: ROUND_ROBIN\n    http2_protocol_options: {}\n    load_assignment:\n      cluster_name: xds_cluster\n      endpoints:\n      - lb_endpoints:\n        - endpoint:\n            address:\n              socket_address: { protocol: TCP, address: @ENVOY_XDS_HOST@, port_value: @ENVOY_XDS_PORT@ }\n  - name: als_cluster\n    connect_timeout: 1s\n    type: STATIC\n    lb_policy: ROUND_ROBIN\n    http2_protocol_options: {}\n    upstream_connection_options:\n      tcp_keepalive: {}\n    load_assignment:\n      cluster_name: als_cluster\n      endpoints:\n      - lb_endpoints:\n        - endpoint:\n            address:\n              socket_address: { protocol: TCP, address: @ENVOY_ALS_HOST@, port_value: @ENVOY_ALS_PORT@ }\n\nlayered_runtime:\n  layers:\n    - name: runtime0\n      rtds_layer:\n        rtds_config:\n          resource_api_version: V3\n          api_config_source:\n            transport_api_version: V3\n            api_type: GRPC\n            grpc_services:\n              envoy_grpc:\n                cluster_name: xds_cluster\n        name: runtime0\n```\n\nWhen you start envoy with docker, you can specify IP and port of `example-envoy-xds` with environment variables.\n\n```shell\n$ docker run --net=host                          \\\n  -e ENVOY_XDS_CLUSTER=example0                  \\\n  -e ENVOY_XDS_NODE_ID=envoy-node1               \\\n  -e ENVOY_XDS_HOST=10.10.0.101                  \\\n  -e ENVOY_XDS_PORT=5000                         \\\n  -e ENVOY_XDS_LOCALITY_REGION=asia-northeast1   \\\n  -e ENVOY_XDS_LOCALITY_ZONE=asia-northeast1-a   \\\n  -e ENVOY_ALS_HOST=10.10.0.101                  \\\n  -e ENVOY_ALS_PORT=5001                         \\\n  docker.pkg.github.com/octu0/example-envoy-xds/envoy:1.21.6\n```\n\nConfigure xDS with grpc, `example-envoy-xds` will be started so that envoy can communicate with it.  \nAt this time, `node.id` of envoy (specified by `ENVOY_XDS_NODE_ID`) must be the same value,  \notherwise the Snapshot will not be changed.\n\n```shell\n$ docker run --net=host           \\\n  -e XDS_NODE_ID=envoy-node1      \\\n  -e XDS_LISTEN_ADDR=0.0.0.0:5000 \\\n  -e ALS_LISTEN_ADDR=0.0.0.0:5001 \\\n  -e CDS_YAML=/app/vol/cds.yaml   \\\n  -e EDS_YAML=/app/vol/eds.yaml   \\\n  -e RDS_YAML=/app/vol/rds.yaml   \\\n  -e LDS_YAML=/app/vol/lds.yaml   \\\n  -v $(pwd):/app/vol              \\\n  docker.pkg.github.com/octu0/example-envoy-xds/example-envoy-xds:1.0.3 server\n```\n\nEdit eds.yaml in current directory to make sure EDS are updated.\n\n## Execution example\n\nUsing docker-compose to check the behavior. \n\n```shell\n$ docker-compose up -d\n```\n\nand curl it.\n\n```shell\n$ curl -H 'Host:example.com' localhost:8080\nlegacy node-003\n\n$ curl -H 'Host:example.com' localhost:8080\nnew node-102\n```\n\n## License\n\nApache 2.0, see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctu0%2Fexample-envoy-xds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctu0%2Fexample-envoy-xds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctu0%2Fexample-envoy-xds/lists"}