Table of Contents generated with DocToc
仓库共包含 5 个分支,对应 5 个不同的解决方案
pkg/kubernetes
├── config // use kubeconfig for benchmark local test
├── health // for apiserver health check livez
└── types // define struct for apiserver list result
pkg/proxy/dev
├── cachemgr.go // cache apiserver list result
├── cachemgr_test.go // unit test
├── checker.go // remote server health check
├── common.go // const define
├── filter.go // for filter benchmark
├── handler.go // edge-proxy handler
├── infra.go // apiserver interface define
├── local.go // local proxy for consistency benchmark
└── remote.go // remote proxy
pkg/benchmark
├── benchmark-consistency.go
├── benchmark-filter.go
├── benchmark-functional.go
├── benchmark-resourceusage.go // use pprof and timer for benchmark
make build
make build 命令会生成两个二进制:edge-proxy 和 benchmark, 存放在目录:_output/local/bin/{GOOS}/{GOARCH}/
export server_addr=$(kubectl config view --minify -o=jsonpath="{.clusters[*].cluster.server}")
export ns=$(kubectl get cm kube-root-ca.crt -o=jsonpath="{.metadata.namespace}")
./edge-proxy --server-addr ${server_addr} --use-kubeconfig true --enable-sample-handler true --disk-cache-path ~/.kube/cloudnative-challenge/cache
./benchmark --namespace ${ns} --use-kubeconfig
make docker-build IMAGE_REPO=registry.cn-shanghai.aliyuncs.com/cloud-native-edge-proxy IMAGE_TAG=v0.0.1 REGION=cn
alias kubectl='kubectl --kubeconfig ~/.kube/cloudnative-challenge/config'
make docker-build
命令用于生成并push edge-proxy镜像 和并且产生用于本地测试的 manifest 文件
参数解析:
make docker-build IMAGE_REPO=registry.cn-shanghai.aliyuncs.com/cloudnative-challenge IMAGE_TAG=v1.0 REGION=cn DOCKER_USERNAME=** DOCKER_PASSWD=**
若 make docker-build
命令执行成功, 会自动 push 镜像到对应的阿里云镜像仓库中,并且在_output/
目录下生成 manifest.yaml
文件。
manifest.yaml
文件里主要包括了测试的pod资源对象。
kubectl apply -f _output/manifest.yaml
执行后, 会在对应命名空间下生成名字为 benchmark 的 pod 对象,此 pod 包含了两个容器, 一个是 edge-proxy 的容器, 一个是 benchmark 的容器, 可以使用 kubectl 命令查看:
kubectl get pod benchmark -o yaml
# 查看 bench-mark 容器日志:
kubectl logs -f benchmark bench-mark
# 查看 edge-proxy 容器日志:
kubectl logs -f benchmark edge-proxy
make docker-build
命令, 重新构建镜像,并 push 镜像kubectl delete -f _output/manifest.yaml
kubectl apply -f _output/manifest.yaml