From e24f1fde466bd1c88963540f108cbe332e0e93e4 Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Wed, 12 Mar 2025 16:01:27 +0100 Subject: [PATCH] Make sure that k8s_cluster_name is set when it has to The agreement is that if a custom remote write is configured and the local fluent-bit forward is not enabled then the users will have a green field labels-wise and the k8s_cluster_name label won't be enforced. --- tests/prometheus/prometheus.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/prometheus/prometheus.yaml b/tests/prometheus/prometheus.yaml index a019b61..e10f24a 100644 --- a/tests/prometheus/prometheus.yaml +++ b/tests/prometheus/prometheus.yaml @@ -21,7 +21,7 @@ tests: apiVersion: "monitoring.coreos.com/v1" name: it-monit-metrics-collector-prometheus not: true - - it: should be deployed with cluster-local remote write by default + - it: should be deployed with cluster-local remote write by default and k8s_cluster_name set set: kubernetes.clusterName: test asserts: @@ -35,6 +35,9 @@ tests: - equal: path: spec.remoteWrite[0].url value: "http://it-monit-metrics-fluentbit:8080/api/prom/push" + - equal: + path: spec.externalLabels.k8s_cluster_name + value: test - it: should be deployed with no remoteWrites if no fluentbit is available set: kubernetes.clusterName: test @@ -47,7 +50,7 @@ tests: - lengthEqual: path: spec.remoteWrite count: 0 - - it: should be deployed with external remote write if configured + - it: should be deployed with external remote write if configured and no external labels set: kubernetes.clusterName: test metrics.fluentbit.enabled: false @@ -70,6 +73,8 @@ tests: password: name: it-monit-metrics-collector-prometheus key: password + - isNullOrEmpty: + path: spec.externalLabels - lengthEqual: path: spec.remoteWrite count: 1 -- GitLab