From 05976762611ac64fe11d6372419b58bc05688f21 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jul 2026 17:52:34 +0200 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A3=B0=E6=98=8E=20NC01=20product?= =?UTF-8?q?ion=20lane=20=E4=B8=8E=2032010=20=E4=B8=8A=E6=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/deploy.yaml | 51 +++++++++++++++++-- scripts/src/gitops-render/core.mjs | 2 + .../src/gitops-render/runtime-manifests.mjs | 1 + scripts/src/runtime-lane.test.mjs | 7 ++- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index f71376bd..73db10cc 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -85,6 +85,9 @@ nodes: gitopsRoot: deploy/gitops/node sourceRepo: git@github.com:pikasTech/HWLAB.git publicHost: 74.48.78.17 + NC01: + gitopsRoot: deploy/gitops/node/nc01 + sourceRepo: git@github.com:pikasTech/HWLAB.git lanes: v02: name: v0.2 @@ -501,7 +504,7 @@ lanes: livenessFailure: false readMode: db-or-degraded fallbackStateSource: false - envReuseServices: + envReuseServices: &v03EnvReuseServices - hwlab-cloud-api - hwlab-workbench-runtime - hwlab-user-billing @@ -510,7 +513,7 @@ lanes: - hwlab-gateway - hwlab-edge-proxy - hwlab-agent-skills - bootScripts: + bootScripts: &v03BootScripts hwlab-cloud-api: deploy/runtime/boot/hwlab-cloud-api.sh hwlab-workbench-runtime: deploy/runtime/boot/hwlab-workbench-runtime.sh hwlab-user-billing: deploy/runtime/boot/hwlab-user-billing.sh @@ -519,7 +522,7 @@ lanes: hwlab-gateway: deploy/runtime/boot/hwlab-gateway.sh hwlab-edge-proxy: deploy/runtime/boot/hwlab-edge-proxy.sh hwlab-agent-skills: deploy/runtime/boot/hwlab-agent-skills.sh - serviceDeclarations: + serviceDeclarations: &v03ServiceDeclarations hwlab-cloud-api: runtimeKind: bun-command entrypoint: cmd/hwlab-cloud-api/main.ts @@ -706,7 +709,7 @@ lanes: env: TZ: Asia/Shanghai observable: true - envRecipe: + envRecipe: &v03EnvRecipe osPackages: - ca-certificates - git @@ -744,7 +747,7 @@ lanes: script: tools/hwpod-ctl.ts - command: hwpod-compiler script: tools/hwpod-compiler-cli.ts - bootConfig: + bootConfig: &v03BootConfig template: default overrides: {} configMaps: @@ -964,6 +967,44 @@ lanes: configMapName: hwlab-v03-project-management-bootstrap mountPath: /etc/hwlab/project-management readOnly: true + production: + name: Production + node: NC01 + sourceBranch: release + gitopsBranch: release-gitops + gitReadUrl: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikasTech-HWLAB.git + gitWriteUrl: http://git-mirror-write.devops-infra.svc.cluster.local:8080/pikasTech/HWLAB.git + artifactCatalog: deploy/artifact-catalog.nc01-production.json + runtimePath: deploy/gitops/node/nc01/runtime-production + namespace: hwlab-production + imageTagMode: full + endpoint: https://lab.hwpod.com + publicEndpoints: + frontend: https://lab.hwpod.com + api: https://lab.hwpod.com + publicServices: + nodes: + NC01: + - name: hwlab-cloud-web-public + selector: + app.kubernetes.io/name: hwlab-cloud-web + port: 80 + targetPort: 8080 + nodePort: 32010 + frp: + enabled: false + envReuseServices: *v03EnvReuseServices + bootScripts: *v03BootScripts + serviceDeclarations: *v03ServiceDeclarations + services: + - serviceId: hwlab-cloud-api + env: + HWLAB_METRICS_NAMESPACE: hwlab-production + - serviceId: hwlab-cloud-web + env: + HWLAB_CLOUD_WEB_OPENCODE_UPSTREAM_URL: http://opencode-server.hwlab-production.svc.cluster.local:4096 + envRecipe: *v03EnvRecipe + bootConfig: *v03BootConfig services: - serviceId: hwlab-cloud-api namespace: hwlab-dev diff --git a/scripts/src/gitops-render/core.mjs b/scripts/src/gitops-render/core.mjs index a2ddd1d9..20137881 100644 --- a/scripts/src/gitops-render/core.mjs +++ b/scripts/src/gitops-render/core.mjs @@ -1185,6 +1185,7 @@ function runtimeFrpConfigForProfile(deploy, profile, args = {}) { const fallbackWebRemotePort = isVersionRuntimeLane(profile) ? defaultPortForRuntimeLane(profile) : profile === "prod" ? 18666 : 17666; const fallbackEdgeRemotePort = isRuntimeLane(profile) ? fallbackWebRemotePort + 1 : profile === "prod" ? 18667 : 17667; const baseFrp = isRuntimeLane(profile) ? runtimeLaneConfig(deploy, profile)?.frp : deploy?.frp; + if (namedRuntimeLane && baseFrp?.enabled === false) return { enabled: false }; const nodeId = effectiveSecretPlaneNodeId(args); const nodeFrp = nodeId ? baseFrp?.nodes?.[nodeId] : null; const frp = nodeFrp && typeof nodeFrp === "object" && !Array.isArray(nodeFrp) ? { ...baseFrp, ...nodeFrp } : baseFrp; @@ -1212,6 +1213,7 @@ function runtimeFrpConfigForProfile(deploy, profile, args = {}) { for (const endpointId of ["frontend", "api"]) assert.ok(proxyByEndpoint.has(endpointId), `deploy.lanes.${profile}.frp.proxies must declare endpointId ${endpointId}`); } return { + enabled: true, serverAddr: typeof server?.address === "string" && server.address.trim().length > 0 ? server.address.trim() : "74.48.78.17", serverPort: Number.isInteger(server?.bindPort) ? server.bindPort : 7000, webRemotePort: proxyPort("frontend", fallbackWebRemotePort), diff --git a/scripts/src/gitops-render/runtime-manifests.mjs b/scripts/src/gitops-render/runtime-manifests.mjs index 7f1b97e1..b873c0ca 100644 --- a/scripts/src/gitops-render/runtime-manifests.mjs +++ b/scripts/src/gitops-render/runtime-manifests.mjs @@ -108,6 +108,7 @@ function nodeFrpcManifest({ profile = "dev", source = null, deploy = null, args const configName = `${deploymentName}-config`; const proxyPrefix = isRuntimeLane(profile) ? `hwlab-${profile}` : profile === "prod" ? "hwlab-node-prod" : "hwlab-node"; const frpConfig = runtimeFrpConfigForProfile(deploy, profile, args); + if (frpConfig.enabled === false) return { apiVersion: "v1", kind: "List", items: [] }; const webProxyName = frpConfig.webProxyName || `${proxyPrefix}-cloud-web`; const edgeProxyName = frpConfig.edgeProxyName || `${proxyPrefix}-edge-proxy`; const labels = { diff --git a/scripts/src/runtime-lane.test.mjs b/scripts/src/runtime-lane.test.mjs index 480e9d5b..a9c43410 100644 --- a/scripts/src/runtime-lane.test.mjs +++ b/scripts/src/runtime-lane.test.mjs @@ -15,6 +15,7 @@ import { runtimePathForProfile, transformServices } from "./gitops-render/core.mjs"; +import { nodeFrpcManifest } from "./gitops-render/runtime-manifests.mjs"; const namedLaneDeploy = { nodes: { @@ -144,6 +145,10 @@ assert.deepEqual({ edgeRemotePort: 22088 }); +const frpDisabledDeploy = structuredClone(namedLaneDeploy); +frpDisabledDeploy.lanes.production.frp = { enabled: false }; +assert.deepEqual(nodeFrpcManifest({ profile: "production", deploy: frpDisabledDeploy }).items, []); + const incompleteDeploy = structuredClone(namedLaneDeploy); delete incompleteDeploy.lanes.production.namespace; assert.throws( @@ -162,4 +167,4 @@ assert.equal(versionResolved.catalogPath, "deploy/artifact-catalog.v03.json"); assert.equal(runtimeNamespaceForRuntimeLane(versionLaneDeploy, "v03"), "hwlab-v03"); assert.equal(runtimeRelativePathForRuntimeLane(versionLaneDeploy, "v03"), "runtime-v03"); -console.log(JSON.stringify({ ok: true, tests: 18, namedLane: "production", versionLane: "v03" })); +console.log(JSON.stringify({ ok: true, tests: 19, namedLane: "production", versionLane: "v03" })); From 5de36772196f49b830cc48789ce34ffbc0654a0f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jul 2026 18:27:47 +0200 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20production=20Gi?= =?UTF-8?q?tOps=20=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/deploy.yaml | 2 +- scripts/src/runtime-lane.test.mjs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index 73db10cc..60c0dac6 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -975,7 +975,7 @@ lanes: gitReadUrl: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikasTech-HWLAB.git gitWriteUrl: http://git-mirror-write.devops-infra.svc.cluster.local:8080/pikasTech/HWLAB.git artifactCatalog: deploy/artifact-catalog.nc01-production.json - runtimePath: deploy/gitops/node/nc01/runtime-production + runtimePath: runtime-production namespace: hwlab-production imageTagMode: full endpoint: https://lab.hwpod.com diff --git a/scripts/src/runtime-lane.test.mjs b/scripts/src/runtime-lane.test.mjs index a9c43410..fad05c70 100644 --- a/scripts/src/runtime-lane.test.mjs +++ b/scripts/src/runtime-lane.test.mjs @@ -9,6 +9,7 @@ import { runtimeRelativePathForRuntimeLane } from "./runtime-lane.ts"; import { + gitopsPathForProfile, namespaceNameForProfile, parseArgs, runtimeFrpConfigForProfile, @@ -20,7 +21,7 @@ import { nodeFrpcManifest } from "./gitops-render/runtime-manifests.mjs"; const namedLaneDeploy = { nodes: { NC01: { - gitopsRoot: "deploy/gitops/node/NC01", + gitopsRoot: "deploy/gitops/node/nc01", sourceRepo: "git@github.com:pikasTech/HWLAB.git" } }, @@ -99,7 +100,7 @@ assert.deepEqual({ webEndpoint: resolved.webEndpoint }, { nodeId: "NC01", - gitopsRoot: "deploy/gitops/node/NC01", + gitopsRoot: "deploy/gitops/node/nc01", sourceBranch: "release", gitopsBranch: "hwlab-production", gitReadUrl: "http://gitea.example/mirrors/hwlab.git", @@ -112,6 +113,10 @@ assert.equal(runtimeNamespaceForRuntimeLane(namedLaneDeploy, "production"), "hwl assert.equal(runtimeRelativePathForRuntimeLane(namedLaneDeploy, "production"), "runtime-production"); assert.equal(namespaceNameForProfile("production", namedLaneDeploy), "hwlab-production"); assert.equal(runtimePathForProfile("production", namedLaneDeploy), "runtime-production"); +assert.equal( + gitopsPathForProfile(resolved, "production", namedLaneDeploy), + "deploy/gitops/node/nc01/runtime-production" +); const services = transformServices({ services: { apiVersion: "v1", kind: "List", items: [] }, @@ -167,4 +172,4 @@ assert.equal(versionResolved.catalogPath, "deploy/artifact-catalog.v03.json"); assert.equal(runtimeNamespaceForRuntimeLane(versionLaneDeploy, "v03"), "hwlab-v03"); assert.equal(runtimeRelativePathForRuntimeLane(versionLaneDeploy, "v03"), "runtime-v03"); -console.log(JSON.stringify({ ok: true, tests: 19, namedLane: "production", versionLane: "v03" })); +console.log(JSON.stringify({ ok: true, tests: 20, namedLane: "production", versionLane: "v03" }));