{"id":16777019,"url":"https://github.com/rueian/zenvoy","last_synced_at":"2025-04-10T20:14:45.355Z","repository":{"id":45875920,"uuid":"321108575","full_name":"rueian/zenvoy","owner":"rueian","description":"A L4 TCP TPROXY and a XDS server that supports envoy upstream endpoints to be scaled from and to zero.","archived":false,"fork":false,"pushed_at":"2021-12-04T04:50:39.000Z","size":206,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:55:19.575Z","etag":null,"topics":["envoy","k8s-operator","tproxy","xds"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rueian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-13T16:27:24.000Z","updated_at":"2024-11-26T02:18:12.000Z","dependencies_parsed_at":"2022-09-05T08:10:37.223Z","dependency_job_id":null,"html_url":"https://github.com/rueian/zenvoy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rueian%2Fzenvoy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rueian%2Fzenvoy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rueian%2Fzenvoy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rueian%2Fzenvoy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rueian","download_url":"https://codeload.github.com/rueian/zenvoy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288400,"owners_count":21078904,"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","k8s-operator","tproxy","xds"],"created_at":"2024-10-13T07:11:38.635Z","updated_at":"2025-04-10T20:14:45.327Z","avatar_url":"https://github.com/rueian.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zenvoy\n\n![circleci](https://circleci.com/gh/rueian/zenvoy.svg?style=shield)\n[![Maintainability](https://api.codeclimate.com/v1/badges/9706ade6af266b20323c/maintainability)](https://codeclimate.com/github/rueian/zenvoy/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/9706ade6af266b20323c/test_coverage)](https://codeclimate.com/github/rueian/zenvoy/test_coverage)\n\nA L4 TCP TPROXY and a XDS server that supports envoy upstreams (including api servers or even databases) to be scaled from zero and also be scaled to zero.\n\n## Demo\n```\n# deploy the demo\n\n▶ kubectl apply -f example/minikube/kube.yaml\n\n▶ kubectl get po\nNAME                            READY   STATUS        RESTARTS   AGE\nzenvoy-proxy-74cbb84c5-rhhl8    2/2     Running       0          2s   \u003c- this is the L4 TCP ingress\nzenvoy-xds-867674b7c8-v6thp     1/1     Running       0          2s   \u003c- this is the XDS controlling the ingress\n\n# note that wa have only the ingress and the XDS controller. we don't have the active upstream.\n\n▶ kubectl port-forward svc/zenvoy-proxy 10000\nForwarding from 127.0.0.1:10000 -\u003e 10000\nForwarding from [::1]:10000 -\u003e 10000\n\n# now, we send a request to the ingress with no active upstream, but get the response back.\n# that is because the XDS scaled the upstream for us.\n\n▶ curl -H 'HOST: zenvoy-echo' http://localhost:10000\nGET / HTTP/1.1\nHost: zenvoy-echo\nAccept: */*\nContent-Length: 0\nUser-Agent: curl/7.64.1\n\n# re-check our pods, the upstream zenvoy-echo shows up.\n\n▶ kubectl get po\nNAME                           READY   STATUS    RESTARTS   AGE\nzenvoy-echo-64b65fb6b6-vq6x9   1/1     Running   0          1s   \u003c- this is the real upstream just be auto scaled up\nzenvoy-proxy-74cbb84c5-rhhl8   2/2     Running   0          10s\nzenvoy-xds-867674b7c8-v6thp    1/1     Running   0          10s\n\n# wait 5 minutes later, the XDS scaled it down for us.\n\n▶ kubectl get po\nNAME                           READY   STATUS    RESTARTS   AGE\nzenvoy-proxy-74cbb84c5-rhhl8   2/2     Running   0          5m\nzenvoy-xds-867674b7c8-v6thp    1/1     Running   0          5m\n```\n\n## How it works\n\nThe `zenvoy-proxy` is an Envoy + TCP TProxy. They are both connected to the XDS controller\nwhich is watching kubernetes `Endpoints` resources.\n\nWhen XDS controller received an `Endpoints` resource with no healthy pods, it allocates a port mapping\nfor the corresponding `Endpoints` and publish the envoy config to the `zenvoy-proxy`.\n\nWhen the request hits the Envoy of `zenvoy-proxy`, it will be redirected to the TProxy and waits for the real upstream\nto be scaled up by the XDS controller after receiving the metrics from the Envoy.\n\nOnce the real upstream is scaled up, the TProxy uses the port mapping to redirect pending request to the real upstream.\nAnd the TProxy is also removed from the Envoy config at the same time by the XDS controller.\nFuture requests will go to real upstream directly.\n\nAfter a configurable timeout, the XDS controller will scale down the upstream if there is no more requests sent to the upstream.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frueian%2Fzenvoy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frueian%2Fzenvoy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frueian%2Fzenvoy/lists"}