fix: gate d601 v03 postgres mode by yaml switch (#972)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-26 14:01:49 +08:00
committed by GitHub
parent 0b923fc5ee
commit fc6d3bdaf9
8 changed files with 55 additions and 20 deletions
+12 -10
View File
@@ -37,10 +37,12 @@ import { compactRuntimeCommand, runNodeHostScript } from "./runtime-common";
import { assertLane, assertNodeId, keyValueLinesFromText, numericField, optionValue, optionalStringValue, positiveIntegerOption, positiveIntegerValue, record, requiredOption, shellQuote, statusText, stringValue, stripOptions } from "./utils";
import { discoverWebObserveIndexEntry, readWebObserveIndexEntry } from "./web-observe-render";
import { assertKnownOptions, nodeWebProbeAutoCommandTimeoutSeconds, nodeWebProbeDefaultUrl, normalizeNodeWebProbeObserveArgs, parseNodeWebProbeObserveOptions, parseNodeWebProbeSentinelOptions, parseWebProbeBrowserProxyMode } from "./web-probe-observe";
import { hwlabRuntimeActiveExternalPostgres } from "../hwlab-node-lanes";
export function nodeRuntimeRenderOverlay(spec: HwlabRuntimeLaneSpec): Record<string, unknown> {
const gitSshProxy = httpProxyEndpoint(spec.networkProfile.proxy.http);
const gitMirror = nodeRuntimeGitMirrorTarget(spec);
const activeExternalPostgres = hwlabRuntimeActiveExternalPostgres(spec);
const renderGitMirror = {
...gitMirror,
egressProxy: gitMirror.egressProxy.mode === "direct" ? {
@@ -109,13 +111,13 @@ export function nodeRuntimeRenderOverlay(spec: HwlabRuntimeLaneSpec): Record<str
webProxy: spec.publicExposure.webProxy,
apiProxy: spec.publicExposure.apiProxy,
},
externalPostgres: spec.externalPostgres === undefined ? undefined : {
externalPostgres: activeExternalPostgres === undefined ? undefined : {
enabled: true,
serviceName: spec.externalPostgres.serviceName,
endpointAddress: spec.externalPostgres.endpointAddress,
port: spec.externalPostgres.port,
runtimeAccess: spec.externalPostgres.runtimeAccess ?? null,
sslmode: spec.externalPostgres.sslmode,
serviceName: activeExternalPostgres.serviceName,
endpointAddress: activeExternalPostgres.endpointAddress,
port: activeExternalPostgres.port,
runtimeAccess: activeExternalPostgres.runtimeAccess ?? null,
sslmode: activeExternalPostgres.sslmode,
},
};
}
@@ -460,7 +462,7 @@ export function sleepSync(ms: number): void {
}
export function syncNodeExternalPostgresSecrets(spec: HwlabRuntimeLaneSpec, dryRun: boolean, timeoutSeconds: number): Record<string, unknown> | null {
const pg = spec.externalPostgres;
const pg = hwlabRuntimeActiveExternalPostgres(spec);
if (pg === undefined) return null;
const secretRoot = externalPostgresSecretSourceRoot(spec);
const cloudApi = readSecretSourceValue(secretRoot, pg.cloudApi.sourceRef, pg.cloudApi.envKey);
@@ -905,7 +907,7 @@ export function ensureNodeBaseImage(spec: HwlabRuntimeLaneSpec, dryRun: boolean,
}
export function externalPostgresSecretSetupScript(spec: HwlabRuntimeLaneSpec, dryRun: boolean): string {
const pg = spec.externalPostgres;
const pg = hwlabRuntimeActiveExternalPostgres(spec);
if (pg === undefined) return "true";
const authnKey = pg.openfga.authnKey ?? "authn-preshared-key";
return [
@@ -1068,7 +1070,7 @@ export function isLocalPostgresObject(name: string, spec: HwlabRuntimeLaneSpec):
}
export function externalPostgresBridgeStatus(spec: HwlabRuntimeLaneSpec, namespaceExists: boolean): Record<string, unknown> {
const pg = spec.externalPostgres;
const pg = hwlabRuntimeActiveExternalPostgres(spec);
if (pg === undefined) return { required: false, ready: true };
if (!namespaceExists) return { required: true, ready: false, degradedReason: "runtime-namespace-missing" };
const runtimeAccess = pg.runtimeAccess ?? { endpointAddress: pg.endpointAddress, port: pg.port };
@@ -1113,7 +1115,7 @@ export function externalPostgresBridgeStatus(spec: HwlabRuntimeLaneSpec, namespa
}
export function externalPostgresSecretStatus(spec: HwlabRuntimeLaneSpec, namespaceExists: boolean): Record<string, unknown> {
const pg = spec.externalPostgres;
const pg = hwlabRuntimeActiveExternalPostgres(spec);
if (pg === undefined) return { required: false, ready: true };
if (!namespaceExists) return { required: true, ready: false, degradedReason: "runtime-namespace-missing" };
const cloudApi = secretKeyStatus(spec, pg.cloudApi.secretName, pg.cloudApi.secretKey);