fix(gitops): make local postgres image yaml-driven (#1959)
This commit is contained in:
@@ -384,6 +384,7 @@
|
|||||||
"postgresRuntimeStore": {
|
"postgresRuntimeStore": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"image": { "type": "string", "minLength": 1 },
|
||||||
"poolMax": { "type": "integer", "minimum": 1 }
|
"poolMax": { "type": "integer", "minimum": 1 }
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ lanes:
|
|||||||
port: 5432
|
port: 5432
|
||||||
runtimeStore:
|
runtimeStore:
|
||||||
postgres:
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
poolMax: 4
|
poolMax: 4
|
||||||
connectionTimeoutMs: 5000
|
connectionTimeoutMs: 5000
|
||||||
queryRetryMaxAttempts: 5
|
queryRetryMaxAttempts: 5
|
||||||
|
|||||||
@@ -5006,7 +5006,13 @@ function deviceAgent71FreqManifest({ profile = "dev", source, registryPrefix, ca
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function v02PostgresManifest({ profile = "v02", migrationSql, source }) {
|
function runtimePostgresImageForProfile(deploy, profile) {
|
||||||
|
const postgres = runtimeLaneConfig(deploy, profile)?.runtimeStore?.postgres;
|
||||||
|
const image = postgres && typeof postgres === "object" && !Array.isArray(postgres) ? postgres.image : null;
|
||||||
|
return typeof image === "string" && image.trim().length > 0 ? image.trim() : "postgres:16-alpine";
|
||||||
|
}
|
||||||
|
|
||||||
|
function v02PostgresManifest({ profile = "v02", migrationSql, source, image = "postgres:16-alpine" }) {
|
||||||
const namespace = namespaceNameForProfile(profile);
|
const namespace = namespaceNameForProfile(profile);
|
||||||
const name = `${namespace}-postgres`;
|
const name = `${namespace}-postgres`;
|
||||||
const dbName = `hwlab_${profile}`;
|
const dbName = `hwlab_${profile}`;
|
||||||
@@ -5057,7 +5063,7 @@ function v02PostgresManifest({ profile = "v02", migrationSql, source }) {
|
|||||||
spec: {
|
spec: {
|
||||||
containers: [{
|
containers: [{
|
||||||
name: "postgres",
|
name: "postgres",
|
||||||
image: "127.0.0.1:5000/hwlab/postgres:16-alpine",
|
image,
|
||||||
imagePullPolicy: "IfNotPresent",
|
imagePullPolicy: "IfNotPresent",
|
||||||
env: [
|
env: [
|
||||||
{ name: "POSTGRES_DB", value: dbName },
|
{ name: "POSTGRES_DB", value: dbName },
|
||||||
@@ -5466,7 +5472,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, useDeployImages: args.useDeployImages, metricsSidecarSha256 }));
|
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, 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 }));
|
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}/external-postgres.yaml`, externalPostgresManifest({ profile, config: externalPostgres, source }));
|
||||||
if (isRuntimeLane(profile) && !externalPostgres) putJson(`${runtimePath}/postgres.yaml`, v02PostgresManifest({ profile, migrationSql, source }));
|
if (isRuntimeLane(profile) && !externalPostgres) putJson(`${runtimePath}/postgres.yaml`, v02PostgresManifest({ profile, migrationSql, source, image: runtimePostgresImageForProfile(deploy, profile) }));
|
||||||
if (workbenchRedis) putJson(`${runtimePath}/workbench-redis.yaml`, workbenchRuntimeRedisManifest({ profile, config: workbenchRedis, source }));
|
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}/openfga.yaml`, v02OpenFgaManifest({ profile, source }));
|
||||||
if (isRuntimeLane(profile)) putJson(`${runtimePath}/observability.yaml`, observabilityManifest({ deploy, profile, namespace, labels: profileLabels, annotations, metricsSidecarScript }));
|
if (isRuntimeLane(profile)) putJson(`${runtimePath}/observability.yaml`, observabilityManifest({ deploy, profile, namespace, labels: profileLabels, annotations, metricsSidecarScript }));
|
||||||
|
|||||||
Reference in New Issue
Block a user