diff --git a/internal/analyzers/prometheus.go b/internal/analyzers/prometheus.go index 3dbd4c9..510ea17 100644 --- a/internal/analyzers/prometheus.go +++ b/internal/analyzers/prometheus.go @@ -171,6 +171,10 @@ func checkPrometheusNamespaceSelectors(ctx context.Context, clientSets *k8sutil. namespaces, err := clientSets.KClient.CoreV1().Namespaces().List(ctx, metav1.ListOptions{LabelSelector: labels.SelectorFromSet(labelMap).String(),}) + if err != nil { + return fmt.Errorf("Failed to list Namespaces: %v", err) + } + if len(namespaces.Items) == 0 { return fmt.Errorf("No Namespaces match the provided selector") }