Skip to content

[PrometheusRule] Feature : allow additional labels for alerts #858

@MagicRR

Description

@MagicRR

Problem

When enabling prometheusRule in the helm values, the alert labels are limited to severity, namespace and cnpg_cluster. This lack of options forces the user to use external logic (kustomize patch) to generate the correct labels on alerts.

Proposed solution

Add a field named addAlertExtraLabels in cluster.monitoring.prometheusRule to allow passing custom labels as an object.

Example values :

cluster:  
   monitoring:
      prometheusRule:
        enabled: true
        addAlertExtraLabels: # {}
          # example custom labels
          alert_email: "true"
          environment: staging

Template prometheus_rule :

...
labels:
  severity: critical
  namespace: {{ .namespace }}
  cnpg_cluster: {{ .cluster }}
{{- range $key, $val := .addAlertExtraLabels }}
  {{ $key }}: {{ $val | toString }}
{{- end }}
...

I will create the PR linked to this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions