{"id":26061977,"url":"https://github.com/cloud-org/edge-proxy","last_synced_at":"2025-10-05T01:44:12.709Z","repository":{"id":105371959,"uuid":"515058270","full_name":"cloud-org/edge-proxy","owner":"cloud-org","description":"2022第三届云原生编程挑战赛-赛道2：针对边缘计算场景的ACK@Edge高效的边缘自治方案 队伍: 唔想返工","archived":false,"fork":false,"pushed_at":"2023-06-07T11:36:24.000Z","size":1685,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-08T15:49:59.182Z","etag":null,"topics":["edge-proxy","go","golang","kubernetes","tianchi"],"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/cloud-org.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-18T06:18:16.000Z","updated_at":"2024-03-15T10:00:44.000Z","dependencies_parsed_at":"2023-08-25T11:17:04.666Z","dependency_job_id":null,"html_url":"https://github.com/cloud-org/edge-proxy","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/cloud-org/edge-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-org%2Fedge-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-org%2Fedge-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-org%2Fedge-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-org%2Fedge-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloud-org","download_url":"https://codeload.github.com/cloud-org/edge-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-org%2Fedge-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399610,"owners_count":25980330,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["edge-proxy","go","golang","kubernetes","tianchi"],"created_at":"2025-03-08T15:48:53.727Z","updated_at":"2025-10-05T01:44:12.704Z","avatar_url":"https://github.com/cloud-org.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*\n\n- [edge-proxy](#edge-proxy)\n  - [arch design](#arch-design)\n  - [notice](#notice)\n  - [tree](#tree)\n  - [build binary](#build-binary)\n  - [local test use minikube not in cluster(use kubeconfig)](#local-test-use-minikube-not-in-clusteruse-kubeconfig)\n  - [docker build and push](#docker-build-and-push)\n  - [edge ack cluster test](#edge-ack-cluster-test)\n  - [docker-build and gen manifest yaml file](#docker-build-and-gen-manifest-yaml-file)\n  - [deploy benchmark pod](#deploy-benchmark-pod)\n  - [retest](#retest)\n  - [acknowledgement](#acknowledgement)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## edge-proxy\n\n### arch design\n\n![](./img/arch.png)\n\n### notice\n\n仓库共包含 5 个分支，对应 5 个不同的解决方案\n\n- master：目前排行榜上的代码，对 labelSelector 进行判断以及对响应体裁剪\n- labelSelector-cachemgr：通用的 labelSelector cachemgr，由于主办方说不建议使用 resourceusage label 进行判断，所以实现通用的逻辑\n- resourceusage label 进行判断，所以使用了通用的 labelSelector cachemgr\n- origintype：响应体未压缩的代码，资源分 5w+\n- protobuf：使用 protobuf 协议的代码，接收 protobuf 格式响应体\n- 11-fix-solve-concurrent-coroutine-request-problem：由于大赛测评程序使用了一个协程进行压测，其他分支的 map 没有考虑并发读写安全以及缓存击穿的问题，这个分支做了对应的修改适配\n\n### tree\n\n- `pkg/kubernetes`\n\n```\n├── config        // use kubeconfig for benchmark local test\n├── health        // for apiserver health check livez\n└── types         // define struct for apiserver list result\n```\n\n- `pkg/proxy/dev`\n\n```\n├── cachemgr.go         // cache apiserver list result\n├── cachemgr_test.go    // unit test\n├── checker.go          // remote server health check\n├── common.go           // const define\n├── filter.go           // for filter benchmark\n├── handler.go          // edge-proxy handler\n├── infra.go            // apiserver interface define\n├── local.go            // local proxy for consistency benchmark\n└── remote.go           // remote proxy\n```\n\n- `pkg/benchmark`\n\n```\n├── benchmark-consistency.go\n├── benchmark-filter.go\n├── benchmark-functional.go\n├── benchmark-resourceusage.go // use pprof and timer for benchmark\n```\n\n### build binary\n\n```\nmake build\n```\n\nmake build 命令会生成两个二进制:edge-proxy 和 benchmark, 存放在目录：_output/local/bin/{GOOS}/{GOARCH}/\n\n* edge-proxy 是本次比赛的框架代码，选手可以根据里面的主体逻辑实现对应的功能。\n* benchmark 是提供的一个用于本地调试 edge-proxy 功能的工具，选手也参照 benchmark 提供的代码，对 edge-proxy 更详细的测试。\n\n### local test use minikube not in cluster(use kubeconfig)\n\n```sh\nexport server_addr=$(kubectl config view --minify -o=jsonpath=\"{.clusters[*].cluster.server}\")\nexport ns=$(kubectl get cm kube-root-ca.crt -o=jsonpath=\"{.metadata.namespace}\")\n./edge-proxy --server-addr ${server_addr} --use-kubeconfig true --enable-sample-handler true --disk-cache-path ~/.kube/cloudnative-challenge/cache\n./benchmark --namespace ${ns} --use-kubeconfig\n```\n\n### docker build and push\n\n````sh\nmake docker-build IMAGE_REPO=registry.cn-shanghai.aliyuncs.com/cloud-native-edge-proxy IMAGE_TAG=v0.0.1 REGION=cn\n````\n\n### edge ack cluster test\n\n```sh\nalias kubectl='kubectl --kubeconfig ~/.kube/cloudnative-challenge/config'\n```\n\n### docker-build and gen manifest yaml file\n\n`make docker-build` 命令用于生成并push edge-proxy镜像 和并且产生用于本地测试的 manifest 文件\n\n参数解析：\n\n* IMAGE_REPO 指定镜像 repo\n* IMAGE_TAG 指定镜像 tag\n* REGION 指定是否需要代理\n* DOCKER_USERNAME 指定阿里云镜像仓库的用户名\n* DOCKER_PASSWD 指定阿里云镜像仓库的密码\n\n```\nmake docker-build IMAGE_REPO=registry.cn-shanghai.aliyuncs.com/cloudnative-challenge IMAGE_TAG=v1.0 REGION=cn DOCKER_USERNAME=** DOCKER_PASSWD=**\n```\n\n若 `make docker-build` 命令执行成功， 会自动 push 镜像到对应的阿里云镜像仓库中，并且在`_output/` 目录下生成 `manifest.yaml` 文件。\n`manifest.yaml` 文件里主要包括了测试的pod资源对象。\n\n### deploy benchmark pod\n\n`kubectl apply -f _output/manifest.yaml`\n\n执行后， 会在对应命名空间下生成名字为 benchmark 的 pod 对象，此 pod 包含了两个容器， 一个是 edge-proxy 的容器， 一个是 benchmark 的容器， 可以使用 kubectl 命令查看:\n\n`kubectl get pod benchmark -o yaml`\n\n```\n# 查看 bench-mark 容器日志: \nkubectl logs -f benchmark bench-mark\n\n# 查看 edge-proxy 容器日志:\nkubectl logs -f benchmark edge-proxy\n```\n\n### retest\n\n1. 修改 edge-proxy 代码逻辑\n2. 执行 `make docker-build` 命令， 重新构建镜像，并 push 镜像\n3. 删掉测试 pod\n\n```\nkubectl delete -f _output/manifest.yaml\n```\n\n4. 重新创建测试 pod\n\n```\nkubectl apply -f _output/manifest.yaml\n```\n\n### acknowledgement\n\n- [openyurt](https://github.com/openyurtio/openyurt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-org%2Fedge-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud-org%2Fedge-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-org%2Fedge-proxy/lists"}