From d8a8fc2e178302ba8b833217078d668a26f72319 Mon Sep 17 00:00:00 2001 From: Lorenzo Felletti Date: Tue, 19 Nov 2024 23:15:56 +0000 Subject: [PATCH] feat: use showMultiCluster instead of cluster label --- alerts/kube_apiserver.libsonnet | 4 ++-- lib/utils.libsonnet | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/alerts/kube_apiserver.libsonnet b/alerts/kube_apiserver.libsonnet index 11c09b9ac..558c2acd2 100644 --- a/alerts/kube_apiserver.libsonnet +++ b/alerts/kube_apiserver.libsonnet @@ -61,7 +61,7 @@ local utils = import '../lib/utils.libsonnet'; annotations: { description: 'A client certificate used to authenticate to kubernetes apiserver is expiring in less than %s%s.' % [ (utils.humanizeSeconds($._config.certExpirationWarningSeconds)), - utils.ifClusterLabelSet($._config, ' on cluster {{ $labels.%(clusterLabel)s }}' % $._config), + utils.ifShowMultiCluster($._config, ' on cluster {{ $labels.%(clusterLabel)s }}' % $._config), ], summary: 'Client certificate is about to expire.', }, @@ -80,7 +80,7 @@ local utils = import '../lib/utils.libsonnet'; annotations: { description: 'A client certificate used to authenticate to kubernetes apiserver is expiring in less than %s%s.' % [ (utils.humanizeSeconds($._config.certExpirationCriticalSeconds)), - utils.ifClusterLabelSet($._config, ' on cluster {{ $labels.%(clusterLabel)s }}' % $._config), + utils.ifShowMultiCluster($._config, ' on cluster {{ $labels.%(clusterLabel)s }}' % $._config), ], summary: 'Client certificate is about to expire.', }, diff --git a/lib/utils.libsonnet b/lib/utils.libsonnet index e7b3f6d20..934c11875 100644 --- a/lib/utils.libsonnet +++ b/lib/utils.libsonnet @@ -57,7 +57,7 @@ }, }, - // if clusterLabel is set, return the string, otherwise return an empty string - ifClusterLabelSet(config, string):: - if std.length(config.clusterLabel) > 0 then string else '', + // if showMultiCluster is true in config, return the string, otherwise return an empty string + ifShowMultiCluster(config, string):: + if config.showMultiCluster then string else '', }