helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Allow adding additional labels to alert rules in victoria-metrics-k8s-stack helm chart

Open Cytrian opened this issue 9 months ago • 0 comments

The "victoria-metrics-k8s-stack" is quite a good drop-in replacement for "kube-prometheus-stack".

What I found missing while migrating our setup are additionalRuleLabels for the "k8s-rules" (victoria-helm-charts/charts/victoria-metrics-k8s-stack/templates/rules/k8s.rules.*yaml)

Example: "kube-prometheus-stack" has this block allowing to add general and specific labels:

spec:
  groups:
  - name: k8s.rules.container_cpu_usage_seconds_total
 ...
      labels:
        {{- with .Values.defaultRules.additionalRuleLabels }}
          {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.defaultRules.additionalRuleGroupLabels.k8sContainerCpuUsageSecondsTotal }}
          {{- toYaml . | nindent 8 }}
        {{- end }}
      {{- end }}

Most of the other rules in victoria-helm-charts/charts/victoria-metrics-k8s-stack/templates/rules/ already have at least the .Values.defaultRules.additionalRuleLabels, but they are missing completely for the "k8s-rules".

It looks like some parts of https://github.com/prometheus-community/helm-charts/blob/7d50bd5aa88b73fce522e19053216f9128451be1/charts/kube-prometheus-stack/hack/sync_prometheus_rules.py#L322 are not yet implemented or removed.

Cytrian avatar May 07 '24 20:05 Cytrian