fix: gate prometheus operator resources for v03
This commit is contained in:
@@ -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
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}] : [])
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user