Skip to content

Commit

Permalink
feat: use showMultiCluster instead of cluster label
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzofelletti committed Nov 19, 2024
1 parent 1122d94 commit d8a8fc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions alerts/kube_apiserver.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
},
Expand All @@ -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.',
},
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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 '',
}

0 comments on commit d8a8fc2

Please sign in to comment.