From 0385d056e7239f142d265c9f207bf3f8a1204995 Mon Sep 17 00:00:00 2001 From: Phillip Schichtel Date: Sat, 14 Dec 2024 14:31:23 +0100 Subject: [PATCH] Avoid many-to-many join by collapsing records by claim using max-by Signed-off-by: Phillip Schichtel --- deploy/charts/rules/volume/volume-rules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/charts/rules/volume/volume-rules.json b/deploy/charts/rules/volume/volume-rules.json index 401beb8..8ab6cff 100644 --- a/deploy/charts/rules/volume/volume-rules.json +++ b/deploy/charts/rules/volume/volume-rules.json @@ -9,7 +9,7 @@ "description": "Persistent Volume Claim '{{ $labels.persistentvolumeclaim }}' has no consumer", "summary": "Persistent Volume Claim '{{ $labels.persistentvolumeclaim }}' in namespace '{{ $labels.namespace }}' is not consumed by any pod in any namespace" }, - "expr": "kube_persistentvolumeclaim_info unless (kube_persistentvolumeclaim_info * on(persistentvolumeclaim) group_left kube_pod_spec_volumes_persistentvolumeclaims_info) == 1", + "expr": "kube_persistentvolumeclaim_info unless (kube_persistentvolumeclaim_info * on(persistentvolumeclaim) group_left (max by (persistentvolumeclaim) (kube_pod_spec_volumes_persistentvolumeclaims_info)))) == 1", "for": "5m", "labels": { "severity": "info"