You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting errors when trying to patch or remove alertmanager rules.
RUNTIME ERROR: string index must be a number, got string.
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:123:10-16 thunk <a>
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:123:10-36 function <anonymous>
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:123:10-36 function <excludeRule>
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:153:20-37 thunk <o>
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:137:24 function <patchRule>
vendor/kube-prometheus/lib/rule-sanitizer.libsonnet:153:10-38 object <anonymous>
During manifestation
local kp =
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/addons/managed-cluster.libsonnet') +
{
values+:: {
common+: {
namespace: 'monitoring',
},
},
};
local rulePatches = {
excludedRuleGroups: [
'alertmanager.rules',
],
excludedRules: [
{
name: 'prometheus-operator',
rules: [
{ alert: 'PrometheusOperatorListErrors' },
],
},
],
patchedRules: [
{
name: 'prometheus-operator',
rules: [
{
alert: 'PrometheusOperatorWatchErrors',
labels: {
severity: 'info',
},
},
],
},
],
};
local sanitizePrometheusRules = (import 'kube-prometheus/lib/rule-sanitizer.libsonnet')(rulePatches).sanitizePrometheusRules;
sanitizePrometheusRules({ 'setup/0namespace-namespace': kp.kubePrometheus.namespace } +
{
['setup/prometheus-operator-' + name]: kp.prometheusOperator[name]
for name in std.filter((function(name) name != 'serviceMonitor' && name != 'prometheusRule'), std.objectFields(kp.prometheusOperator))
} +
// serviceMonitor and prometheusRule are separated so that they can be created after the CRDs are ready
{ 'prometheus-operator-serviceMonitor': kp.prometheusOperator.serviceMonitor } +
{ 'prometheus-operator-prometheusRule': kp.prometheusOperator.prometheusRule } +
{ 'kube-prometheus-prometheusRule': kp.kubePrometheus.prometheusRule } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['blackbox-exporter-' + name]: kp.blackboxExporter[name] for name in std.objectFields(kp.blackboxExporter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['kubernetes-' + name]: kp.kubernetesControlPlane[name] for name in std.objectFields(kp.kubernetesControlPlane) }
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) })
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm getting errors when trying to patch or remove alertmanager rules.
I've looked through the rule-patcher examples but I can not get it to work.
Does anyone of you have any idea on how to solve this?
Beta Was this translation helpful? Give feedback.
All reactions