Merge pull request #2429 from pikasTech/fix/2424-jd01-login-500
fix: require TLS for JD01 v03 Cloud API Postgres
This commit is contained in:
@@ -419,6 +419,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"image": { "type": "string", "minLength": 1 },
|
"image": { "type": "string", "minLength": 1 },
|
||||||
|
"sslMode": { "type": "string", "enum": ["disable", "require"] },
|
||||||
"poolMax": { "type": "integer", "minimum": 1 },
|
"poolMax": { "type": "integer", "minimum": 1 },
|
||||||
"connectionTimeoutMs": { "type": "integer", "minimum": 1 },
|
"connectionTimeoutMs": { "type": "integer", "minimum": 1 },
|
||||||
"queryTimeoutMs": { "type": "integer", "minimum": 1 },
|
"queryTimeoutMs": { "type": "integer", "minimum": 1 },
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ lanes:
|
|||||||
runtimeStore:
|
runtimeStore:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
|
sslMode: require
|
||||||
poolMax: 4
|
poolMax: 4
|
||||||
connectionTimeoutMs: 5000
|
connectionTimeoutMs: 5000
|
||||||
queryTimeoutMs: 3000
|
queryTimeoutMs: 3000
|
||||||
|
|||||||
@@ -1182,6 +1182,7 @@ function runtimeStoreEnvForProfile(deploy, profile, serviceId) {
|
|||||||
const postgres = runtimeLaneConfig(deploy, profile)?.runtimeStore?.postgres;
|
const postgres = runtimeLaneConfig(deploy, profile)?.runtimeStore?.postgres;
|
||||||
if (!postgres || typeof postgres !== "object" || Array.isArray(postgres)) return {};
|
if (!postgres || typeof postgres !== "object" || Array.isArray(postgres)) return {};
|
||||||
const env = {};
|
const env = {};
|
||||||
|
if (postgres.sslMode === "disable" || postgres.sslMode === "require") env.HWLAB_CLOUD_DB_SSL_MODE = postgres.sslMode;
|
||||||
if (Number.isInteger(postgres.poolMax)) env.HWLAB_CLOUD_DB_POOL_MAX = String(postgres.poolMax);
|
if (Number.isInteger(postgres.poolMax)) env.HWLAB_CLOUD_DB_POOL_MAX = String(postgres.poolMax);
|
||||||
if (Number.isInteger(postgres.connectionTimeoutMs)) {
|
if (Number.isInteger(postgres.connectionTimeoutMs)) {
|
||||||
env.HWLAB_CLOUD_DB_PROBE_TIMEOUT_MS = String(postgres.connectionTimeoutMs);
|
env.HWLAB_CLOUD_DB_PROBE_TIMEOUT_MS = String(postgres.connectionTimeoutMs);
|
||||||
|
|||||||
@@ -637,6 +637,7 @@ test("v03 render keeps node identity as data instead of generated structure", as
|
|||||||
assert.equal(cloudApiEnv.get("HWLAB_BOOT_COMMIT"), sourceRevision);
|
assert.equal(cloudApiEnv.get("HWLAB_BOOT_COMMIT"), sourceRevision);
|
||||||
assert.equal(cloudApiEnv.get("HWLAB_GITOPS_SOURCE_COMMIT"), sourceRevision);
|
assert.equal(cloudApiEnv.get("HWLAB_GITOPS_SOURCE_COMMIT"), sourceRevision);
|
||||||
assert.equal(cloudApiEnv.get("HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT"), sourceRevision);
|
assert.equal(cloudApiEnv.get("HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT"), sourceRevision);
|
||||||
|
assert.equal(cloudApiEnv.get("HWLAB_CLOUD_DB_SSL_MODE"), "require");
|
||||||
assert.match(cloudApiEnv.get("HWLAB_ENVIRONMENT_IMAGE") ?? "", /hwlab-cloud-api-env:env-stale/u);
|
assert.match(cloudApiEnv.get("HWLAB_ENVIRONMENT_IMAGE") ?? "", /hwlab-cloud-api-env:env-stale/u);
|
||||||
assert.deepEqual(cloudApiEnvEntries.get("HWLAB_SECRET_PLANE_SMOKE")?.valueFrom?.secretKeyRef, { name: "hwlab-secret-plane-smoke", key: "password", optional: true });
|
assert.deepEqual(cloudApiEnvEntries.get("HWLAB_SECRET_PLANE_SMOKE")?.valueFrom?.secretKeyRef, { name: "hwlab-secret-plane-smoke", key: "password", optional: true });
|
||||||
assert.ok((cloudApi?.spec?.template?.spec?.volumes ?? []).some((volume) => volume.name === "hwpod-preinstalled-specs" && volume.configMap?.name === "hwlab-v03-hwpod-preinstalled-specs"));
|
assert.ok((cloudApi?.spec?.template?.spec?.volumes ?? []).some((volume) => volume.name === "hwpod-preinstalled-specs" && volume.configMap?.name === "hwlab-v03-hwpod-preinstalled-specs"));
|
||||||
|
|||||||
Reference in New Issue
Block a user