Merge pull request #2555 from pikasTech/fix/2548-production-pac-source
feat: 声明 NC01 production lane 与 32010 上游
This commit is contained in:
+46
-5
@@ -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: 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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -9,17 +9,19 @@ import {
|
||||
runtimeRelativePathForRuntimeLane
|
||||
} from "./runtime-lane.ts";
|
||||
import {
|
||||
gitopsPathForProfile,
|
||||
namespaceNameForProfile,
|
||||
parseArgs,
|
||||
runtimeFrpConfigForProfile,
|
||||
runtimePathForProfile,
|
||||
transformServices
|
||||
} from "./gitops-render/core.mjs";
|
||||
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"
|
||||
}
|
||||
},
|
||||
@@ -98,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",
|
||||
@@ -111,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: [] },
|
||||
@@ -144,6 +150,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 +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: 18, namedLane: "production", versionLane: "v03" }));
|
||||
console.log(JSON.stringify({ ok: true, tests: 20, namedLane: "production", versionLane: "v03" }));
|
||||
|
||||
Reference in New Issue
Block a user