Merge pull request #2398 from pikasTech/fix/2393-jd01-observability-crd
fix: gate v03 prometheus operator resources
This commit is contained in:
@@ -401,6 +401,9 @@
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"pattern": "\\{trace_id\\}"
|
||||
},
|
||||
"prometheusOperatorResources": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
}] : [])
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ export type RuntimeLaneConfig = {
|
||||
};
|
||||
observability?: {
|
||||
traceExplorerUrlTemplate?: string;
|
||||
prometheusOperatorResources?: boolean;
|
||||
};
|
||||
sourceRepo?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user