Metric-based resource selection
ResourceSelector now supports querying a Prometheus-compatible endpoint before evaluating each resource. Add metricSource (endpoint URL, optional auth via Secret) and metricQueries (PromQL expressions) to any ResourceSelector — the results are injected into the Lua evaluate script as a global metrics table.
This lets you gate resource actions on live cluster data: scale down Deployments only when their error rate exceeds a threshold, restart Pods only when memory saturation is reported, or skip cleanup entirely when the cluster is under load.
metricSource:
url: http://prometheus-server.monitoring.svc:9090
metricQueries:
- name: errorRate
query: sum(rate(http_requests_errors_total[5m])) / sum(rate(http_requests_total[5m]))
evaluate: |
function evaluate()
hs = {}
hs.matching = metrics["errorRate"] ~= nil and metrics["errorRate"] > 0.05
return hs
endAlso: upgraded vitest from 3.x to 4.x to fix a critical vulnerability (GHSA-5xrq-8626-4rwp, CVSS 9.8).