Skip to content

Commit dd6bcaf

Browse files
committed
[#6173] remove KubeClientCertificateExpiration alerts
> Also it appears that it is not easy to remove a field in jsonnet once it is set, so it is better to just not set it. bitnami/kube-libsonnet#74
1 parent 0de5897 commit dd6bcaf

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

build/kube-prometheus/common-template.jsonnet

+28-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,34 @@ local kp =
234234
(if vars['blackbox-exporter'] then { ['blackbox-exporter-' + name]: kp.blackboxExporter[name] for name in std.objectFields(kp.blackboxExporter) } else {}) +
235235
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } +
236236
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
237-
{ ['kubernetes-' + name]: kp.kubernetesControlPlane[name] for name in std.objectFields(kp.kubernetesControlPlane) }
237+
{ ['kubernetes-' + name]: kp.kubernetesControlPlane[name] for name in std.objectFields(kp.kubernetesControlPlane) } +
238+
// Ordering matters! This next absurd object **has** to come after the inclusion
239+
// of `kubernetesControlPlane` above -- otherwise we'll overwrite the object and
240+
// remove our filtering.
241+
{ 'kubernetes-prometheusRule': kp.kubernetesControlPlane.prometheusRule {
242+
spec+: {
243+
groups: std.filter((
244+
function(o)
245+
std.objectHas(o, 'rules') && o.name != 'kubernetes-system-apiserver'
246+
), kp.kubernetesControlPlane.prometheusRule.spec.groups)
247+
+
248+
[{
249+
name: 'kubernetes-system-apiserver',
250+
rules:
251+
std.filter(
252+
(
253+
function(o)
254+
std.objectHas(o, 'alert') &&
255+
o.alert != 'KubeClientCertificateExpiration'
256+
),
257+
std.filter((
258+
function(o)
259+
std.objectHas(o, 'rules') && o.name == 'kubernetes-system-apiserver'
260+
), kp.kubernetesControlPlane.prometheusRule.spec.groups)[0].rules
261+
),
262+
}],
263+
},
264+
} } +
238265
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
239266
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
240267
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +

0 commit comments

Comments
 (0)