feat: 声明 NC01 production lane 与 32010 上游

This commit is contained in:
root
2026-07-15 17:52:34 +02:00
parent f5d8f3c505
commit 0597676261
4 changed files with 55 additions and 6 deletions
+46 -5
View File
@@ -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
+2
View File
@@ -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),
@@ -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 = {
+6 -1
View File
@@ -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" }));