fix: gate prometheus operator resources for v03

This commit is contained in:
UniDesk Codex
2026-07-06 15:23:04 +08:00
parent 2e7c55a0e9
commit b0d5b8323d
4 changed files with 15 additions and 3 deletions
+3
View File
@@ -401,6 +401,9 @@
"type": "string",
"minLength": 1,
"pattern": "\\{trace_id\\}"
},
"prometheusOperatorResources": {
"type": "boolean"
}
},
"additionalProperties": false
+1
View File
@@ -339,6 +339,7 @@ lanes:
autoCollapseTerminal: false
observability:
traceExplorerUrlTemplate: /v1/workbench/traces/{trace_id}/events
prometheusOperatorResources: false
opencode:
image: 127.0.0.1:5000/hwlab/opencode:1.17.7-git
providerProfile: dsflash-go
+10 -3
View File
@@ -1142,6 +1142,12 @@ function runtimeTraceExplorerUrlTemplate(deploy, profile) {
return typeof template === "string" && template.trim().length > 0 ? template.trim() : null;
}
function runtimePrometheusOperatorResourcesEnabled(deploy, profile) {
if (!isRuntimeLane(profile)) return true;
const enabled = runtimeLaneConfig(deploy, profile)?.observability?.prometheusOperatorResources;
return enabled !== false;
}
function runtimeStoreEnvForProfile(deploy, profile, serviceId) {
if (!isRuntimeLane(profile) || serviceId !== "hwlab-cloud-api") return {};
const postgres = runtimeLaneConfig(deploy, profile)?.runtimeStore?.postgres;
@@ -1581,6 +1587,7 @@ function transformServices({ services, namespace, labels, annotations, profile =
function observabilityManifest({ deploy, profile, namespace, labels, annotations, metricsSidecarScript }) {
assert.ok(isRuntimeLane(profile), `observability profile must be a runtime lane, got ${profile}`);
const includePrometheusOperatorResources = runtimePrometheusOperatorResourcesEnabled(deploy, profile);
const baseLabels = {
...labels,
"app.kubernetes.io/part-of": "hwlab",
@@ -1621,8 +1628,8 @@ function observabilityManifest({ deploy, profile, namespace, labels, annotations
metadata: { name: `hwlab-${profile}-metrics-sidecar`, namespace, labels: baseLabels, annotations },
data: { "metrics-sidecar.mjs": metricsSidecarScript }
},
...serviceMonitors,
{
...(includePrometheusOperatorResources ? serviceMonitors : []),
...(includePrometheusOperatorResources ? [{
apiVersion: "monitoring.coreos.com/v1",
kind: "PrometheusRule",
metadata: { name: `hwlab-${profile}-observability`, namespace, labels: baseLabels, annotations },
@@ -1647,7 +1654,7 @@ function observabilityManifest({ deploy, profile, namespace, labels, annotations
]
}]
}
}
}] : [])
]
};
}
+1
View File
@@ -46,6 +46,7 @@ export type RuntimeLaneConfig = {
};
observability?: {
traceExplorerUrlTemplate?: string;
prometheusOperatorResources?: boolean;
};
sourceRepo?: string;
};