fix: migrate external runtime PostgreSQL schema

This commit is contained in:
root
2026-07-16 23:31:31 +02:00
parent 49bcd22640
commit bc9e3a349a
3 changed files with 108 additions and 3 deletions
+16 -1
View File
@@ -728,7 +728,22 @@ test("v03 render keeps node identity as data instead of generated structure", as
assert.ok((projectManagementContainer?.volumeMounts ?? []).some((mount) => mount.name === "project-management-bootstrap" && mount.mountPath === "/etc/hwlab/project-management"));
assert.ok((projectManagementContainer?.env ?? []).some((entry) => entry.name === "HWLAB_PROJECT_MANAGEMENT_BOOTSTRAP_SOURCES_PATH" && entry.value === "/etc/hwlab/project-management/sources.json"));
const externalPostgres = JSON.parse(await readFile(path.join(outDir, "runtime-v03", "external-postgres.yaml"), "utf8"));
assert.deepEqual((externalPostgres.items ?? []).map((item) => item.kind), ["Service", "EndpointSlice"]);
assert.deepEqual((externalPostgres.items ?? []).map((item) => item.kind), ["ConfigMap", "Job", "Service", "EndpointSlice"]);
const externalPostgresMigrationConfig = (externalPostgres.items ?? []).find((item) => item.kind === "ConfigMap");
const externalPostgresMigrationJob = (externalPostgres.items ?? []).find((item) => item.kind === "Job");
assert.deepEqual(
Object.keys(externalPostgresMigrationConfig?.data ?? {}).filter((name) => name.endsWith(".sql")),
CLOUD_CORE_MIGRATIONS.map((migration) => path.basename(migration.path))
);
assert.equal(externalPostgresMigrationJob?.metadata?.annotations?.["argocd.argoproj.io/sync-wave"], "-1");
assert.equal(
externalPostgresMigrationJob?.spec?.template?.spec?.containers?.[0]?.image,
`127.0.0.1:5000/hwlab/hwlab-cloud-api-env@sha256:${"1".repeat(64)}`
);
assert.deepEqual(externalPostgresMigrationJob?.spec?.template?.spec?.containers?.[0]?.env?.[0]?.valueFrom?.secretKeyRef, {
name: "hwlab-cloud-api-v03-db",
key: "database-url"
});
const externalPostgresSlice = (externalPostgres.items ?? []).find((item) => item.kind === "EndpointSlice");
assert.equal(externalPostgresSlice?.metadata?.name, "jd01-pk01-platform-postgres-host");
assert.equal(externalPostgresSlice?.metadata?.labels?.["kubernetes.io/service-name"], "jd01-pk01-platform-postgres");