From aabff4059b806276d0bc237a32282771f5200a59 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 26 May 2026 03:56:53 +0800 Subject: [PATCH] feat: expose G14 prod through FRP --- deploy/frp/README.md | 23 +++++++----- deploy/frp/frpc.g14-prod.toml | 17 +++++++++ deploy/frp/frps.dev.toml | 8 ++++ docs/reference/dev-runtime-boundary.md | 5 +++ docs/reference/g14-gitops-cicd.md | 3 +- scripts/g14-gitops-render.mjs | 52 ++++++++++++++++---------- 6 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 deploy/frp/frpc.g14-prod.toml diff --git a/deploy/frp/README.md b/deploy/frp/README.md index c036d799..30987e71 100644 --- a/deploy/frp/README.md +++ b/deploy/frp/README.md @@ -7,7 +7,7 @@ The DEV reverse link is D601 to master edge through frp. - `hwlab-tunnel-client` owns the frp client health contract. - `hwlab-cloud-web` owns the public browser entry on port `16666`. - `hwlab-edge-proxy` owns public API/health ingress on port `16667`. -- `frps.dev.toml` reserves D601 `16666` / `16667`, G14 `17666` / `17667`, and tunnel health `7402` +- `frps.dev.toml` reserves D601 `16666` / `16667`, G14 DEV `17666` / `17667`, G14 PROD `18666` / `18667`, and tunnel health `7402` as TCP `remotePort` values; do not also bind them as `vhostHTTPPort`, because that collides with the DEV TCP proxy. - `deploy/deploy.json` is the source for the public endpoints and FRP proxy @@ -20,17 +20,22 @@ The DEV reverse link is D601 to master edge through frp. ## G14 public preview -G14 uses a separate preview port range and must not reuse D601's `16666` / `16667`: +G14 uses separate preview port ranges and must not reuse D601's `16666` / `16667`: -- G14 browser endpoint: `http://74.48.78.17:17666` -- G14 API/edge endpoint: `http://74.48.78.17:17667` -- G14 frpc proxy names: `hwlab-g14-cloud-web` and `hwlab-g14-edge-proxy` -- G14 k3s Deployment: `hwlab-dev/hwlab-g14-frpc`, generated by `scripts/g14-gitops-render.mjs` +- G14 DEV browser endpoint: `http://74.48.78.17:17666` +- G14 DEV API/edge endpoint: `http://74.48.78.17:17667` +- G14 DEV frpc proxy names: `hwlab-g14-cloud-web` and `hwlab-g14-edge-proxy` +- G14 DEV k3s Deployment: `hwlab-dev/hwlab-g14-frpc`, generated by `scripts/g14-gitops-render.mjs` +- G14 PROD browser endpoint: `http://74.48.78.17:18666` +- G14 PROD API/edge endpoint: `http://74.48.78.17:18667` +- G14 PROD frpc proxy names: `hwlab-g14-prod-cloud-web` and `hwlab-g14-prod-edge-proxy` +- G14 PROD k3s Deployment: `hwlab-prod/hwlab-g14-prod-frpc`, generated by `scripts/g14-gitops-render.mjs` - Master frps allow-list template: `deploy/frp/frps.dev.toml` -- G14 frpc local template: `deploy/frp/frpc.g14.toml` +- G14 DEV frpc local template: `deploy/frp/frpc.g14.toml` +- G14 PROD frpc local template: `deploy/frp/frpc.g14-prod.toml` Only `hwlab-cloud-web:8080` and `hwlab-edge-proxy:6667` are exposed through FRP. Internal services, Tekton, Argo CD, registry, database, and simulator services stay ClusterIP-only. -The master-side `/opt/hwlab-frp/frps.dev.toml` may need a manual allow-list update matching `deploy/frp/frps.dev.toml` before -the G14 frpc Deployment can register `17666` and `17667`; this is an edge operation, not a D601 +The master-side `/opt/hwlab-frp/frps.dev.toml` and active `/etc/frp/frps.toml` may need a manual allow-list update matching `deploy/frp/frps.dev.toml` before +the G14 frpc Deployments can register `17666` / `17667` and `18666` / `18667`; this is an edge operation, not a D601 client change. diff --git a/deploy/frp/frpc.g14-prod.toml b/deploy/frp/frpc.g14-prod.toml new file mode 100644 index 00000000..5d65db0d --- /dev/null +++ b/deploy/frp/frpc.g14-prod.toml @@ -0,0 +1,17 @@ +serverAddr = "74.48.78.17" +serverPort = 7000 +loginFailExit = true + +[[proxies]] +name = "hwlab-g14-prod-cloud-web" +type = "tcp" +localIP = "hwlab-cloud-web.hwlab-prod.svc.cluster.local" +localPort = 8080 +remotePort = 18666 + +[[proxies]] +name = "hwlab-g14-prod-edge-proxy" +type = "tcp" +localIP = "hwlab-edge-proxy.hwlab-prod.svc.cluster.local" +localPort = 6667 +remotePort = 18667 diff --git a/deploy/frp/frps.dev.toml b/deploy/frp/frps.dev.toml index 53fab415..faaf3767 100644 --- a/deploy/frp/frps.dev.toml +++ b/deploy/frp/frps.dev.toml @@ -16,6 +16,14 @@ end = 17666 start = 17667 end = 17667 +[[allowPorts]] +start = 18666 +end = 18666 + +[[allowPorts]] +start = 18667 +end = 18667 + [[allowPorts]] start = 7402 end = 7402 diff --git a/docs/reference/dev-runtime-boundary.md b/docs/reference/dev-runtime-boundary.md index 5fdcee7e..c6c0fafb 100644 --- a/docs/reference/dev-runtime-boundary.md +++ b/docs/reference/dev-runtime-boundary.md @@ -22,6 +22,11 @@ master hwlab-frps-dev :17666/:17667 -> G14 hwlab-g14-frpc in namespace hwlab-dev -> hwlab-cloud-web on internal :8080 for browser traffic -> hwlab-edge-proxy / hwlab-cloud-api on internal :6667 for API and health + +master hwlab-frps-dev :18666/:18667 +-> G14 hwlab-g14-prod-frpc in namespace hwlab-prod +-> hwlab-cloud-web on internal :8080 for browser traffic +-> hwlab-edge-proxy / hwlab-cloud-api on internal :6667 for API and health ``` G14 PROD is rendered by GitOps as namespace `hwlab-prod` and Argo CD application `hwlab-g14-prod`; it uses the `:18666/:18667` public endpoints when enabled. G14 desired state is generated into `deploy/gitops/g14/runtime-dev` and `deploy/gitops/g14/runtime-prod` and promoted through the `G14-gitops` branch. diff --git a/docs/reference/g14-gitops-cicd.md b/docs/reference/g14-gitops-cicd.md index 606afa9c..50759b37 100644 --- a/docs/reference/g14-gitops-cicd.md +++ b/docs/reference/g14-gitops-cicd.md @@ -9,6 +9,7 @@ G14 是 HWLAB 当前 DEV/PROD 原生 k8s 与 GitOps 运行面目标。G14 CI/CD - Artifact:镜像使用 commit tag,例如 `127.0.0.1:5000/hwlab/hwlab-cloud-api:`;digest 由 registry 返回,CI report 只作为审计证据,不作为 CD 真相。 - Branch split:`G14` 是源码监控分支;`G14-gitops` 是 Tekton promotion 写入的生成分支,保存 `deploy/gitops/g14/**` desired state。 - CD:Argo CD 只消费 `G14-gitops:deploy/gitops/g14/runtime-dev` 与 `deploy/gitops/g14/runtime-prod` 的 Git desired state,不重新构建镜像,不读取 D601 状态,不获取 legacy DEV CD Lease。 +- FRP:G14 DEV 通过 `hwlab-dev/hwlab-g14-frpc` 暴露 `17666/17667`,G14 PROD 通过 `hwlab-prod/hwlab-g14-prod-frpc` 暴露 `18666/18667`;master frps 的 `deploy/frp/frps.dev.toml` 与实际 `/etc/frp/frps.toml` 必须同时放行这四个 G14 端口。 - 并行性:不同 source commit 的 CI build 不共享发布锁;并行安全由 immutable commit tag/digest 和 Git desired state 保证。最终运行版本由 Argo CD 当前同步的 Git revision 决定。 ## 生成入口 @@ -79,7 +80,7 @@ KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl -n hwlab-ci logs pod/