feat: 拉通 Workbench 纯 Kafka 实时链路

This commit is contained in:
root
2026-07-10 10:22:28 +02:00
parent d5230cb923
commit 8ad5976a07
59 changed files with 4700 additions and 498 deletions
+14 -6
View File
@@ -18,6 +18,7 @@ import {
versionNameForRuntimeLane
} from "./src/runtime-lane.ts";
import { readStructuredFile } from "./src/structured-config.mjs";
import { CLOUD_CORE_MIGRATIONS } from "../internal/db/schema.ts";
const execFileAsync = promisify(execFile);
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
@@ -5074,7 +5075,7 @@ function runtimePostgresImageForProfile(deploy, profile) {
return typeof image === "string" && image.trim().length > 0 ? image.trim() : "postgres:16-alpine";
}
function v02PostgresManifest({ profile = "v02", migrationSql, source, image = "postgres:16-alpine" }) {
function v02PostgresManifest({ profile = "v02", migrationSources, source, image = "postgres:16-alpine" }) {
const namespace = namespaceNameForProfile(profile);
const name = `${namespace}-postgres`;
const dbName = `hwlab_${profile}`;
@@ -5086,6 +5087,9 @@ function v02PostgresManifest({ profile = "v02", migrationSql, source, image = "p
"hwlab.pikastech.local/profile": profile,
"hwlab.pikastech.local/source-commit": source.full
};
assert.ok(Array.isArray(migrationSources) && migrationSources.length > 0, "runtime Postgres migration chain is required");
const migrationSql = migrationSources.map((migration) => migration.sql).join("\n");
const migrationData = Object.fromEntries(migrationSources.map((migration) => [path.basename(migration.path), migration.sql]));
const migrationSha256 = createHash("sha256").update(migrationSql).digest("hex");
const templateLabels = {
"app.kubernetes.io/name": name,
@@ -5104,7 +5108,7 @@ function v02PostgresManifest({ profile = "v02", migrationSql, source, image = "p
apiVersion: "v1",
kind: "ConfigMap",
metadata: { name: `${name}-init`, namespace, labels },
data: { "0001_cloud_core_skeleton.sql": migrationSql }
data: migrationData
},
{
apiVersion: "v1",
@@ -5907,9 +5911,13 @@ async function plannedFiles(args) {
if (!artifactCatalog) artifactCatalog = await readJson(args.catalogPath);
const settings = ciLaneSettings(args);
const profiles = laneRuntimeProfiles(args);
const migrationSql = isRuntimeLane(args.lane)
? await readFile(path.join(repoRoot, "internal/db/migrations/0001_cloud_core_skeleton.sql"), "utf8")
: null;
const migrationSources = isRuntimeLane(args.lane)
? await Promise.all(CLOUD_CORE_MIGRATIONS.map(async (migration) => ({
id: migration.id,
path: migration.path,
sql: await readFile(path.join(repoRoot, migration.path), "utf8")
})))
: [];
const metricsSidecarScript = isRuntimeLane(args.lane)
? await readFile(path.join(repoRoot, "internal/dev-entrypoint/metrics-sidecar.mjs"), "utf8")
: null;
@@ -5987,7 +5995,7 @@ async function plannedFiles(args) {
putJson(`${runtimePath}/workloads.yaml`, transformWorkloads({ workloads, deploy, catalog: artifactCatalog, source, sourceBranch: args.sourceBranch, gitReadUrl: args.gitReadUrl, registryPrefix: args.registryPrefix, runtimeEndpoint: endpoints.runtimeEndpoint, webEndpoint: endpoints.webEndpoint, profile, nodeId: args.nodeId, useDeployImages: args.useDeployImages, metricsSidecarSha256 }));
putJson(`${runtimePath}/deepseek-proxy.yaml`, deepSeekProxyManifest({ profile, source, sourceBranch: args.sourceBranch, sourceRepo: args.sourceRepo, gitReadUrl: args.gitReadUrl, deploy, registryPrefix: args.registryPrefix, catalog: artifactCatalog, useDeployImages: args.useDeployImages, metricsSidecarSha256 }));
if (isRuntimeLane(profile) && externalPostgres) putJson(`${runtimePath}/external-postgres.yaml`, externalPostgresManifest({ profile, config: externalPostgres, source }));
if (isRuntimeLane(profile) && !externalPostgres) putJson(`${runtimePath}/postgres.yaml`, v02PostgresManifest({ profile, migrationSql, source, image: runtimePostgresImageForProfile(deploy, profile) }));
if (isRuntimeLane(profile) && !externalPostgres) putJson(`${runtimePath}/postgres.yaml`, v02PostgresManifest({ profile, migrationSources, source, image: runtimePostgresImageForProfile(deploy, profile) }));
if (workbenchRedis) putJson(`${runtimePath}/workbench-redis.yaml`, workbenchRuntimeRedisManifest({ profile, config: workbenchRedis, source }));
if (isRuntimeLane(profile)) putJson(`${runtimePath}/openfga.yaml`, v02OpenFgaManifest({ profile, source }));
if (isRuntimeLane(profile)) putJson(`${runtimePath}/observability.yaml`, observabilityManifest({ deploy, profile, namespace, labels: profileLabels, annotations, metricsSidecarScript }));